Update Transformers to huggingface_hub >= 0.1.0 (#14251)

* Update Transformers to huggingface_hub >= 0.1.0

* Forgot to save...

* Style

* Fix test
This commit is contained in:
Sylvain Gugger
2021-11-02 18:58:42 -04:00
committed by GitHub
parent 519a677e87
commit 558f8543ba
15 changed files with 70 additions and 172 deletions

View File

@@ -24,12 +24,11 @@ import unittest
from importlib import import_module
from typing import List, Tuple
from huggingface_hub import HfApi
from huggingface_hub import delete_repo, login
from requests.exceptions import HTTPError
from transformers import is_tf_available
from transformers.models.auto import get_values
from transformers.testing_utils import (
ENDPOINT_STAGING,
PASS,
USER,
CaptureLogger,
@@ -1530,18 +1529,17 @@ class UtilsFunctionsTest(unittest.TestCase):
class TFModelPushToHubTester(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls._api = HfApi(endpoint=ENDPOINT_STAGING)
cls._token = cls._api.login(username=USER, password=PASS)
cls._token = login(username=USER, password=PASS)
@classmethod
def tearDownClass(cls):
try:
cls._api.delete_repo(token=cls._token, name="test-model-tf")
delete_repo(token=cls._token, name="test-model-tf")
except HTTPError:
pass
try:
cls._api.delete_repo(token=cls._token, name="test-model-tf-org", organization="valid_org")
delete_repo(token=cls._token, name="test-model-tf-org", organization="valid_org")
except HTTPError:
pass