You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

download_deps.py 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env python3
  2. # PEP 723 metadata
  3. # /// script
  4. # requires-python = ">=3.10"
  5. # dependencies = [
  6. # "huggingface-hub",
  7. # "nltk",
  8. # ]
  9. # ///
  10. from huggingface_hub import snapshot_download
  11. import nltk
  12. import os
  13. import urllib.request
  14. urls = [
  15. "http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb",
  16. "http://ports.ubuntu.com/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_arm64.deb",
  17. "https://repo1.maven.org/maven2/org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar",
  18. "https://repo1.maven.org/maven2/org/apache/tika/tika-server-standard/3.0.0/tika-server-standard-3.0.0.jar.md5",
  19. "https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken",
  20. "https://bit.ly/chrome-linux64-121-0-6167-85",
  21. "https://bit.ly/chromedriver-linux64-121-0-6167-85",
  22. ]
  23. repos = [
  24. "InfiniFlow/text_concat_xgb_v1.0",
  25. "InfiniFlow/deepdoc",
  26. "InfiniFlow/huqie",
  27. "BAAI/bge-large-zh-v1.5",
  28. "BAAI/bge-reranker-v2-m3",
  29. "maidalun1020/bce-embedding-base_v1",
  30. "maidalun1020/bce-reranker-base_v1",
  31. ]
  32. def download_model(repo_id):
  33. local_dir = os.path.abspath(os.path.join("huggingface.co", repo_id))
  34. os.makedirs(local_dir, exist_ok=True)
  35. snapshot_download(repo_id=repo_id, local_dir=local_dir, local_dir_use_symlinks=False)
  36. if __name__ == "__main__":
  37. for url in urls:
  38. filename = url.split("/")[-1]
  39. print(f"Downloading {url}...")
  40. if not os.path.exists(filename):
  41. urllib.request.urlretrieve(url, filename)
  42. local_dir = os.path.abspath('nltk_data')
  43. for data in ['wordnet', 'punkt', 'punkt_tab']:
  44. print(f"Downloading nltk {data}...")
  45. nltk.download(data, download_dir=local_dir)
  46. for repo_id in repos:
  47. print(f"Downloading huggingface repo {repo_id}...")
  48. download_model(repo_id)