Skip to content

Commit

Permalink
🔥py38 + torch 2 🔥🔥🔥🚀 (huggingface#22204)
Browse files Browse the repository at this point in the history
* py38 + torch 2

* increment cache versions

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
  • Loading branch information
ydshieh and ydshieh authored Mar 16, 2023
1 parent fb366b9 commit 5110e57
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Ensure running with CircleCI/huggingface
check_circleci_user:
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
parallelism: 1
steps:
- run: echo $CIRCLE_PROJECT_USERNAME
Expand All @@ -26,7 +26,7 @@ jobs:
fetch_tests:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
parallelism: 1
steps:
- checkout
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
fetch_all_tests:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
parallelism: 1
steps:
- checkout
Expand All @@ -111,7 +111,7 @@ jobs:
check_code_quality:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
resource_class: large
environment:
TRANSFORMERS_IS_CI: yes
Expand All @@ -121,8 +121,8 @@ jobs:
- checkout
- restore_cache:
keys:
- v0.5-code_quality-{{ checksum "setup.py" }}
- v0.5-code-quality
- v0.6-code_quality-{{ checksum "setup.py" }}
- v0.6-code-quality
- run: pip install --upgrade pip
- run: pip install .[all,quality]
- save_cache:
Expand All @@ -144,7 +144,7 @@ jobs:
check_repository_consistency:
working_directory: ~/transformers
docker:
- image: cimg/python:3.7.12
- image: cimg/python:3.8.12
resource_class: large
environment:
TRANSFORMERS_IS_CI: yes
Expand All @@ -154,8 +154,8 @@ jobs:
- checkout
- restore_cache:
keys:
- v0.5-repository_consistency-{{ checksum "setup.py" }}
- v0.5-repository_consistency
- v0.6-repository_consistency-{{ checksum "setup.py" }}
- v0.6-repository_consistency
- run: pip install --upgrade pip
- run: pip install .[all,quality]
- save_cache:
Expand Down
4 changes: 2 additions & 2 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"RUN_PT_FLAX_CROSS_TESTS": False,
}
COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "dist": "loadfile", "s": None}
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.7.12"}]
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.8.12"}]


@dataclass
class CircleCIJob:
name: str
additional_env: Dict[str, Any] = None
cache_name: str = None
cache_version: str = "0.5"
cache_version: str = "0.6"
docker_image: List[Dict[str, str]] = None
install_steps: List[str] = None
marker: Optional[str] = None
Expand Down
2 changes: 1 addition & 1 deletion tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ def test_eos_token_id_int_and_list_top_k_top_sampling(self):
"top_k": 10,
"temperature": 0.7,
}
expectation = 15
expectation = 20

tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2")
text = """Hello, my dog is cute and"""
Expand Down
2 changes: 2 additions & 0 deletions tests/onnx/test_onnx_v2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import unittest
from pathlib import Path
from tempfile import NamedTemporaryFile
from unittest import TestCase
Expand Down Expand Up @@ -499,6 +500,7 @@ def test_tensorflow_export_seq2seq_with_past(
class StableDropoutTestCase(TestCase):
"""Tests export of StableDropout module."""

@unittest.skip("torch 2.0.0 gives `torch.onnx.errors.OnnxExporterError: Module onnx is not installed!`.")
@require_torch
@pytest.mark.filterwarnings("ignore:.*Dropout.*:UserWarning:torch.onnx.*") # torch.onnx is spammy.
def test_training(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ def test_small_model_pt(self):
image = Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png")
output = image_classifier(image, candidate_labels=["a", "b", "c"])

self.assertEqual(
# The floating scores are so close, we enter floating error approximation and the order is not guaranteed across
# python and torch versions.
self.assertIn(
nested_simplify(output),
[{"score": 0.333, "label": "a"}, {"score": 0.333, "label": "b"}, {"score": 0.333, "label": "c"}],
[
[{"score": 0.333, "label": "a"}, {"score": 0.333, "label": "b"}, {"score": 0.333, "label": "c"}],
[{"score": 0.333, "label": "a"}, {"score": 0.333, "label": "c"}, {"score": 0.333, "label": "b"}],
],
)

output = image_classifier([image] * 5, candidate_labels=["A", "B", "C"], batch_size=2)
Expand Down
1 change: 1 addition & 0 deletions tests/trainer/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,7 @@ def test_torchdynamo_full_eval(self):
self.assertAlmostEqual(metrics["eval_loss"], original_eval_loss)
torchdynamo.reset()

@unittest.skip("torch 2.0.0 gives `ModuleNotFoundError: No module named 'torchdynamo'`.")
@require_torch_non_multi_gpu
@require_torchdynamo
def test_torchdynamo_memory(self):
Expand Down

0 comments on commit 5110e57

Please sign in to comment.