Fix num. of minimal calls to the Hub with peft for pipeline - #26385
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.
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.
use_auth_token is already deprecated.
|
The documentation is not available anymore as the PR was closed or merged. |
LysandreJik
left a comment
There was a problem hiding this comment.
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.
subfolder was never in hub_kwargs here
sgugger
left a comment
There was a problem hiding this comment.
This looks good to me, thanks for expanding my fix!
|
Merge now. |
ArthurZucker
left a comment
There was a problem hiding this comment.
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_headbut 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