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

* initial work

* Add other classes

* Refactor code

* Move warning and fix dynamic pipeline

* Issue warning when necessary

* Add test
This commit is contained in:
Sylvain Gugger
2023-04-17 11:36:29 -04:00
committed by GitHub
parent 4d2c52e830
commit ea7b0a539a
12 changed files with 98 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)