手动从 huggingface 下载模型之后,怎么把模型文件放到指定路径? 我需要在本地运行 chatGLM3,然后我就用下面的代码跑 from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True) model = AutoModel.from_pretrained("THUDM/chatglm3-6b", trust_remote_code=True, device='cuda') model = model.eval() response, history = model.chat(tokenizer, "你好", history=[]) 运行上面的代码,首先会从 huggingface 下载 10GB 左右的模型文件。但是问题来了,huggingface 的下载速度太慢了。所以我就想手动下载:https://huggingface.co/THUDM/chatglm3-6b/tree/main 但是问题在于,huggingface 奇葩的本地目录结构: ╰─➤ fd -a -u pytorch_model | grep chatglm3-6b /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00007-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00003-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00006-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00004-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00001-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model.bin.index.json /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00002-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/snapshots/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model-00005-of-00007.bin /home/pon/.cache/huggingface/hub/models--THUDM--chatglm3-6b/.no_exist/e46a14881eae613281abbd266ee918e93a56018f/pytorch_model.bin 有一串莫名其妙的 snapshots/e46a14881eae613281abbd266ee918e93a56018f !!!! so, 我手动下载了模型文件之后,我怎么知道要把这些模型文件放哪个路径?上哪知道是 e46a14881eae613281abbd266ee918e93a56018f 还是 e46a14881eae613281abbd266ee918e93a56018w?
"https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894136980_S739.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894136980_S739.png) "https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894156613_ZXx9.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894156613_ZXx9.png) "https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894172349_zreA.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894172349_zreA.png) "https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894187978_rGg2.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724894187978_rGg2.png) 大致一看好像行,但是细节很模糊,看不清字
二叉树前序遍历 /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Return an array of size *returnSize. * Note: The returned array must be malloced, assume caller calls free(). */ int* preorderTraversal(struct TreeNode* root, int* returnSize) { int i = 0; //int *arr = (int *)malloc(100*sizeof(int)); if(root) { returnSize[i++] = root->val; preorderTraversal(root->left, returnSize); preorderTraversal(root->right, returnSize); } return returnSize; }
最近逛 b站的时候,发现有这种 Ai视频小助理,可以实现内容总结 "https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724895071670_2PdG.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724895071670_2PdG.png) 这个功能点,刚好可以契合我的项目的一些需求,所以有什么开源工具可以实现视频内容总结? 视频 https://www.bilibili.com/video/BV1s4421A7nb/?t=50.664128&spm_id_from=333.1350.jump_directly