Use code on the Hub from another repo (#22814)

* initial work

* Add other classes

* Refactor code

* Move warning and fix dynamic pipeline

* Issue warning when necessary

* Add test

* Do not skip auto tests

* Fix failing tests

* Refactor and address review comments

* Address review comments
This commit is contained in:
Sylvain Gugger
2023-04-18 13:46:11 -04:00
committed by GitHub
parent aec10d162f
commit 5f9b825c89
15 changed files with 124 additions and 66 deletions

View File

@@ -727,9 +727,8 @@ def pipeline(
" set the option `trust_remote_code=True` to remove this error."
)
class_ref = targeted_task["impl"]
module_file, class_name = class_ref.split(".")
pipeline_class = get_class_from_dynamic_module(
model, module_file + ".py", class_name, revision=revision, use_auth_token=use_auth_token
class_ref, model, revision=revision, use_auth_token=use_auth_token
)
else:
normalized_task, targeted_task, task_options = check_task(task)