Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

collect_model_urls.py 484 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  1. import pathlib
  2. import re
  3. import sys
  4. MODEL_URL_PATTERN = re.compile(r"https://download[.]pytorch[.]org/models/.+?[.]pth")
  5. def main(*roots):
  6. model_urls = set()
  7. for root in roots:
  8. for path in pathlib.Path(root).rglob("*.py"):
  9. with open(path, "r") as file:
  10. for line in file:
  11. model_urls.update(MODEL_URL_PATTERN.findall(line))
  12. print("\n".join(sorted(model_urls)))
  13. if __name__ == "__main__":
  14. main(*sys.argv[1:])
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...