File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1414from typing import Union
1515
1616import nltk
17+ from huggingface_hub import snapshot_download
1718
1819
1920def get_urls (use_china_mirrors = False ) -> list [Union [str , list [str ]]]:
@@ -39,6 +40,19 @@ def get_urls(use_china_mirrors=False) -> list[Union[str, list[str]]]:
3940 ]
4041
4142
43+ repos = [
44+ "InfiniFlow/text_concat_xgb_v1.0" ,
45+ "InfiniFlow/deepdoc" ,
46+ "InfiniFlow/huqie" ,
47+ ]
48+
49+
50+ def download_model (repo_id ):
51+ local_dir = os .path .abspath (os .path .join ("huggingface.co" , repo_id ))
52+ os .makedirs (local_dir , exist_ok = True )
53+ snapshot_download (repo_id = repo_id , local_dir = local_dir )
54+
55+
4256if __name__ == "__main__" :
4357 parser = argparse .ArgumentParser (description = "Download dependencies with optional China mirror support" )
4458 parser .add_argument ("--china-mirrors" , action = "store_true" , help = "Use China-accessible mirrors for downloads" )
@@ -57,3 +71,7 @@ def get_urls(use_china_mirrors=False) -> list[Union[str, list[str]]]:
5771 for data in ["wordnet" , "punkt" , "punkt_tab" ]:
5872 print (f"Downloading nltk { data } ..." )
5973 nltk .download (data , download_dir = local_dir )
74+
75+ for repo_id in repos :
76+ print (f"Downloading huggingface repo { repo_id } ..." )
77+ download_model (repo_id )
You can’t perform that action at this time.
0 commit comments