-
Notifications
You must be signed in to change notification settings - Fork 31.2k
[ModularChecker] QOL for the modular checker
#41361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
molbap
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks super nice, thanks!
| snapshot_path = snapshot_download(repo_id=self.hub_dataset, repo_type="dataset") | ||
| snapshot_dir = Path(snapshot_path) | ||
| missing = [ | ||
| fname for fname in (EMBEDDINGS_PATH, INDEX_MAP_PATH, TOKENS_PATH) if not (snapshot_dir / fname).exists() | ||
| ] | ||
| if missing: | ||
| raise FileNotFoundError("Missing expected files in Hub snapshot: " + ", ".join(missing)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaner handling, thanks :D
utils/modular_model_detector.py
Outdated
| dict[str, str]: mapping of model_id -> ISO date string (YYYY-MM-DD). | ||
| Files without a match are simply omitted. | ||
| """ | ||
| import transformers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import transformers |
utils/modular_model_detector.py
Outdated
| for md_path in root.glob("*.md"): | ||
| try: | ||
| text = md_path.read_text(encoding="utf-8", errors="ignore") | ||
| except Exception: | ||
| # Skip unreadable files quietly | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can log the file to INFO I suppose
| try: | ||
| source = file_path.read_text(encoding="utf-8") | ||
| except (FileNotFoundError, OSError): | ||
| return {} | ||
|
|
||
| try: | ||
| tree = ast.parse(source) | ||
| except SyntaxError: | ||
| return {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious, why the try/catch patterns here? Fine to keep them though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex going crazy heaha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it does allow us to keep going on the script
| parser = argparse.ArgumentParser(prog="hf-code-sim") | ||
| parser.add_argument("--build", action="store_true") | ||
| parser.add_argument("--modeling-file", type=str) | ||
| parser.add_argument("--modeling-file", type=str, help='You can just specify "vits" if you are lazy like me.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😁
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
* update * fancy table fancy prints * download to cache folder, never need it everagain * stule * update based on review
What does this PR do?