Skip to content

Commit a313f59

Browse files
added a test to read from private repo
1 parent 69a2985 commit a313f59

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/openvino/test_modeling.py

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import gc
1616
import os
17+
import subprocess
1718
import tempfile
1819
import time
1920
import unittest
@@ -247,6 +248,15 @@ def test_load_from_hub_and_save_stable_diffusion_model(self):
247248
del pipeline
248249
gc.collect()
249250

251+
def test_load_model_from_hub_private_with_token(self):
252+
subprocess.run("huggingface-cli logout", shell=True)
253+
254+
# a fine-grained read-only token of private repo "IlyasMoutawwakil/test-hub-bert"
255+
token = "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"
256+
257+
loaded_model = OVModelForMaskedLM.from_pretrained("IlyasMoutawwakil/test-hub-bert", use_auth_token=token)
258+
self.assertIsInstance(loaded_model.config, PretrainedConfig)
259+
250260

251261
class OVModelForSequenceClassificationIntegrationTest(unittest.TestCase):
252262
SUPPORTED_ARCHITECTURES = (

0 commit comments

Comments
 (0)