Spaces:
Sleeping
Sleeping
| import os | |
| # downloadhf.py | |
| from huggingface_hub import hf_hub_download | |
| import os | |
| # 模型信息和本地保存路径 | |
| repo_id = 'sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2' | |
| local_dir = '/workspaces/codespaces-jupyter/internLM_RAG/models/sentence-transformer' # 更改为当前路径下的子目录 | |
| # 确保本地保存路径存在 | |
| os.makedirs(local_dir, exist_ok=True) | |
| # 下载模型 | |
| files_to_download = ['model.safetensors', 'config.json', 'pytorch_model.bin', 'tokenizer.json', 'tokenizer_config.json'] | |
| for filename in files_to_download: | |
| hf_hub_download( | |
| repo_id=repo_id, | |
| filename=filename, | |
| local_dir=local_dir | |
| ) | |
| print("模型下载完成。") | |