Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove read token #1903

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you revoked this token @fxmarty ? (I imagine that yes but just to make sure)

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
Loading