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.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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-small-zh-v1.5",
  28. # "BAAI/bge-large-zh-v1.5",
  29. # "BAAI/bge-reranker-v2-m3",
  30. # "maidalun1020/bce-embedding-base_v1",
  31. # "maidalun1020/bce-reranker-base_v1",
  32. ]
  33. def download_model(repo_id):
  34. local_dir = os.path.abspath(os.path.join("huggingface.co", repo_id))
  35. os.makedirs(local_dir, exist_ok=True)
  36. snapshot_download(repo_id=repo_id, local_dir=local_dir, local_dir_use_symlinks=False)
  37. if __name__ == "__main__":
  38. for url in urls:
  39. filename = url.split("/")[-1]
  40. print(f"Downloading {url}...")
  41. if not os.path.exists(filename):
  42. urllib.request.urlretrieve(url, filename)
  43. local_dir = os.path.abspath('nltk_data')
  44. for data in ['wordnet', 'punkt', 'punkt_tab']:
  45. print(f"Downloading nltk {data}...")
  46. nltk.download(data, download_dir=local_dir)
  47. for repo_id in repos:
  48. print(f"Downloading huggingface repo {repo_id}...")
  49. download_model(repo_id)