-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Fix num. of minimal calls to the Hub with peft for pipeline #26385
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
pretrained_model_name_or_path = None | ||
if isinstance(config, str): | ||
pretrained_model_name_or_path = config | ||
elif config is None and isinstance(model, str): | ||
pretrained_model_name_or_path = model |
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.
try to get the repo. in different case before going to the next block of getting config, similar to the block in line 758
f"{model} is not a valid model_id." | ||
) | ||
task = get_task(model, use_auth_token) | ||
task = get_task(model, token) |
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.
use_auth_token
is already deprecated.
The documentation is not available anymore as the PR was closed or merged. |
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.
This seems okay to me generally, would like another review as it's touching critical code.
Not too sure how we could do it, but it would also be nice to have tests for this, as it's the kind of thing that will continue to break unless we actively test it.
We do have tests: 4 tests named |
elif config is None and isinstance(model, str): | ||
# Check for an adapter file in the model path if PEFT is available | ||
if is_peft_available(): | ||
subfolder = hub_kwargs.get("subfolder", None) |
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.
subfolder
was never in hub_kwargs
here
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.
This looks good to me, thanks for expanding my fix!
Merge now. |
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.
Feel free to merge!
What does this PR do?
This is a continuation of #25715 where @sgugger fix
test_cached_model_has_minimum_calls_to_head
but nottest_cached_pipeline_has_minimum_calls_to_head
(as I didn't mention this to him).This PR mostly copies the logic from #25715.
The current failing test and the error are
tests/pipelines/test_pipelines_common.py::CustomPipelineTest::test_cached_pipeline_has_minimum_calls_to_head (line 905) AssertionError: 2 != 1