Skip to content
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
3 changes: 1 addition & 2 deletions tests/generation/test_configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import tempfile
import unittest

from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from parameterized import parameterized
from requests.exceptions import HTTPError

Expand Down Expand Up @@ -99,7 +99,6 @@ class ConfigPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is removed. In the PR description, you mentioned use set_git_credential if needed. I am wondering why this PR doesn't use set_git_credential?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think set_access_token was not needed in the first place. I suspect that it was used multiple times because of copy-pasting legacy code even though the tests do not need to authenticate with git. I have not reviewed in detail all the impacted tests but I thought that if the tests are passing, then it was not really needed (hence not using set_git_credential).

Maybe to be double-checked as I'm not used to transformers's CI.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, likely. Also probably we needed it before not no longer the case. I will wait to see what Sylvain says first :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I think so. Now all the tests seems to use the HTTP endpoints which is nice :)

HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/models/auto/test_processor_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pathlib import Path
from shutil import copyfile

from huggingface_hub import HfFolder, Repository, create_repo, delete_repo, set_access_token
from huggingface_hub import HfFolder, Repository, create_repo, delete_repo
from requests.exceptions import HTTPError

from transformers import (
Expand Down Expand Up @@ -219,7 +219,6 @@ class ProcessorPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/pipelines/test_pipelines_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import datasets
import numpy as np
from huggingface_hub import HfFolder, Repository, create_repo, delete_repo, set_access_token
from huggingface_hub import HfFolder, Repository, create_repo, delete_repo
from requests.exceptions import HTTPError

from transformers import (
Expand Down Expand Up @@ -759,7 +759,6 @@ class DynamicPipelineTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_configuration_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import unittest.mock as mock
from pathlib import Path

from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError

from transformers import AutoConfig, BertConfig, GPT2Config, is_torch_available
Expand Down Expand Up @@ -222,7 +222,6 @@ class ConfigPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_feature_extraction_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import unittest.mock as mock
from pathlib import Path

from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError

from transformers import AutoFeatureExtractor, Wav2Vec2FeatureExtractor
Expand Down Expand Up @@ -100,7 +100,6 @@ class FeatureExtractorPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_image_processing_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import unittest.mock as mock
from pathlib import Path

from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError

from transformers import AutoImageProcessor, ViTImageProcessor
Expand Down Expand Up @@ -232,7 +232,6 @@ class ImageProcessorPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_modeling_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from typing import Dict, List, Tuple

import numpy as np
from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from huggingface_hub.file_download import http_get
from pytest import mark
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -3429,7 +3429,6 @@ class ModelPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_modeling_flax_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from typing import List, Tuple

import numpy as np
from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError

import transformers
Expand Down Expand Up @@ -1173,7 +1173,6 @@ class FlaxModelPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_modeling_tf_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from typing import List, Tuple, get_type_hints

from datasets import Dataset
from huggingface_hub import HfFolder, Repository, delete_repo, set_access_token
from huggingface_hub import HfFolder, Repository, delete_repo
from huggingface_hub.file_download import http_get
from requests.exceptions import HTTPError

Expand Down Expand Up @@ -2409,7 +2409,6 @@ class TFModelPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tokenization_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Tuple, Union

from huggingface_hub import HfFolder, delete_repo, set_access_token
from huggingface_hub import HfFolder, delete_repo
from huggingface_hub.file_download import http_get
from parameterized import parameterized
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -3971,7 +3971,6 @@ class TokenizerPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions tests/trainer/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from unittest.mock import Mock, patch

import numpy as np
from huggingface_hub import HfFolder, Repository, delete_repo, set_access_token
from huggingface_hub import HfFolder, Repository, delete_repo
from parameterized import parameterized
from requests.exceptions import HTTPError

Expand Down Expand Up @@ -2005,7 +2005,6 @@ class TrainerIntegrationWithHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._token = TOKEN
set_access_token(TOKEN)
HfFolder.save_token(TOKEN)

@classmethod
Expand Down