Skip to content

Commit

Permalink
Remove set_access_token usage + fail tests if FutureWarning (huggingf…
Browse files Browse the repository at this point in the history
…ace#22051)

* Remove set_access_token usage + fail tests if FutureWarning

* do not fail on FutureWarning in CI

---------

Co-authored-by: testbot <[email protected]>
  • Loading branch information
Wauplin and testbot authored Mar 9, 2023
1 parent 6847743 commit 923110b
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 22 deletions.
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)
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

0 comments on commit 923110b

Please sign in to comment.