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.

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