-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Fix local repos with remote code not registering for pipelines #33100
Conversation
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. |
0bb67d8
to
b2eb197
Compare
5f4eb03
to
8142311
Compare
This is now ready for review! The explanation for it is a bit confusing, though. The original issue is that custom code models did not correctly register with the pipeline model mappings when they were loaded from a local directory instead of from the Hub. The cause is this block of code that treats models differently when they are loaded from a local dir: if os.path.isdir(config._name_or_path):
model_class.register_for_auto_class(cls.__name__)
else:
cls.register(config.__class__, model_class, exist_ok=True) When I investigated, this code block was added by @sgugger to fix another issue, where custom code models loaded from local directories did not correctly save their modeling files when saved with In testing, I tried reverting this change, and it appears that custom code models now correctly save those files even after the revert. Therefore, this PR reverts the change, and adds two new tests, one test to ensure that loading a local custom code model in a pipeline works now (this test fails without this PR), and one test to ensure that custom code models loaded from a local dir still correctly save their modeling files (this test passes on cc @LysandreJik |
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.
Ok the fix works for me and the test is good! As said in the other PR, would it be possible to move the user-owned repos to hf-internal-testing
?
@LysandreJik done! |
…ngface#33100) * Extremely experimental fix! * Try removing the clause entirely * Add test * make fixup * stash commit * Remove breakpoint * Add anti-regression test * make fixup * Move repos to hf-internal-testing!
…ngface#33100) * Extremely experimental fix! * Try removing the clause entirely * Add test * make fixup * stash commit * Remove breakpoint * Add anti-regression test * make fixup * Move repos to hf-internal-testing!
…ngface#33100) * Extremely experimental fix! * Try removing the clause entirely * Add test * make fixup * stash commit * Remove breakpoint * Add anti-regression test * make fixup * Move repos to hf-internal-testing!
Draft PR, don't merge! Experimenting with fixes for the issue with local repos and remote code not registering correctly for pipelines.
TODO:
model_class.register_for_auto_class(cls.__name__)
entirely?Fixes #32923