Skip to content

Commit

Permalink
Remove read token (#1903)
Browse files Browse the repository at this point in the history
* remove read token

* rename var & use org model

* style & remove token

* fix failing tests on datasets release
  • Loading branch information
fxmarty authored Jun 14, 2024
1 parent db51410 commit f480930
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test_onnxruntime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
pytest onnxruntime -m "run_in_series" --durations=0 -vvvv -s
- name: Test with pytest (in parallel)
env:
FXMARTYCLONE_READ_TOKEN: ${{ secrets.HF_HUB_READ_TOKEN }}
working-directory: tests
run: |
pytest onnxruntime -m "not run_in_series" --durations=0 -vvvv -s -n auto
3 changes: 0 additions & 3 deletions optimum/utils/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@
# Used to test the hub
USER = "__DUMMY_OPTIMUM_USER__"

# Not critical, only usable on the sandboxed CI instance.
TOKEN = "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"


def flatten_dict(dictionary: Dict):
"""
Expand Down
11 changes: 7 additions & 4 deletions tests/onnxruntime/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,14 @@ def test_stable_diffusion_model_on_rocm_ep_str(self):
self.assertListEqual(model.providers, ["ROCMExecutionProvider", "CPUExecutionProvider"])

def test_load_model_from_hub_private(self):
subprocess.run("huggingface-cli logout", shell=True)
# Read token of fxmartyclone (dummy user).
token = "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"
token = os.environ.get("HF_HUB_READ_TOKEN", None)

model = ORTModelForCustomTasks.from_pretrained("fxmartyclone/tiny-onnx-private-2", use_auth_token=token)
if token is None:
self.skipTest("Test requires a token for fxmartyclone in the environment variable `HF_HUB_READ_TOKEN`.")

model = ORTModelForCustomTasks.from_pretrained(
"optimum-internal-testing/tiny-random-phi-private", use_auth_token=token
)
self.assertIsInstance(model.model, onnxruntime.InferenceSession)
self.assertIsInstance(model.config, PretrainedConfig)

Expand Down
7 changes: 6 additions & 1 deletion tests/utils/test_task_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dataset_data_keys": {"question": "question", "context": "answer"},
},
"image-classification": {
"dataset_args": "mnist",
"dataset_args": "sasha/dog-food",
"dataset_data_keys": {"image": "image"},
},
}
Expand Down Expand Up @@ -232,6 +232,11 @@ def test_load_dataset_with_max_length(self):
input_ids = dataset[0]["input_ids"]
self.assertEqual(len(input_ids), max_length)

def test_load_default_dataset(self):
self.skipTest(
"Skipping so as not to execute conll2003 remote code (test would require trust_remote_code=True)"
)


class QuestionAnsweringProcessorTest(TestCase, TaskProcessorTestBase):
TASK_NAME = "question-answering"
Expand Down

0 comments on commit f480930

Please sign in to comment.