Fix local repos with remote code not registering for pipelines (#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!
This commit is contained in:
@@ -22,7 +22,7 @@ from pathlib import Path
|
||||
|
||||
import datasets
|
||||
import numpy as np
|
||||
from huggingface_hub import HfFolder, delete_repo
|
||||
from huggingface_hub import HfFolder, Repository, delete_repo
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
from transformers import (
|
||||
@@ -226,6 +226,14 @@ class CommonPipelineTest(unittest.TestCase):
|
||||
pipe.model = None
|
||||
self.assertIsNone(pipe.torch_dtype)
|
||||
|
||||
@require_torch
|
||||
def test_auto_model_pipeline_registration_from_local_dir(self):
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
_ = Repository(local_dir=tmp_dir, clone_from="hf-internal-testing/tiny-random-custom-architecture")
|
||||
pipe = pipeline("text-generation", tmp_dir, trust_remote_code=True)
|
||||
|
||||
self.assertIsInstance(pipe, TextGenerationPipeline) # Assert successful load
|
||||
|
||||
|
||||
@is_pipeline_test
|
||||
class PipelineScikitCompatTest(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user