瀏覽代碼

Merge pull request #9 from yjmm10/support-modelscope

Support modelscope
redmoe-moutain 3 月之前
父節點
當前提交
7be0c5e2ac
共有 3 個文件被更改,包括 11 次插入2 次删除
  1. 3 0
      README.md
  2. 2 1
      requirements.txt
  3. 6 1
      tools/download_model.py

+ 3 - 0
README.md

@@ -1015,6 +1015,9 @@ pip install -e .
 > 💡**Note:** Please use a directory name without periods (e.g., `DotsOCR` instead of `dots.ocr`) for the model save path. This is a temporary workaround pending our integration with Transformers.
 ```shell
 python3 tools/download_model.py
+
+# with modelscope
+python3 tools/download_model.py --type modelscope
 ```
 
 

+ 2 - 1
requirements.txt

@@ -7,5 +7,6 @@ openai
 qwen_vl_utils
 transformers==4.51.3
 huggingface_hub
+modelscope
 flash-attn==2.8.0.post2
-accelerate
+accelerate

+ 6 - 1
tools/download_model.py

@@ -15,5 +15,10 @@ if __name__ == '__main__':
     if args.type == "huggingface":
         from huggingface_hub import snapshot_download
         snapshot_download(repo_id=args.name, local_dir=model_dir, local_dir_use_symlinks=False, resume_download=True)
+    elif args.type == "modelscope":
+        from modelscope import snapshot_download
+        snapshot_download(repo_id=args.name, local_dir=model_dir)
+    else:
+        raise ValueError(f"Invalid type: {args.type}")
     
-    print(f"model downloaded to {model_dir}")
+    print(f"model downloaded to {model_dir}")