From 7bcf7da3a268b435777fe87c7794c382f444e86d Mon Sep 17 00:00:00 2001 From: Nikita Shulga <2453524+malfet@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:25:09 -0700 Subject: [PATCH] Add tensorboard to pip requirements (#109349) (#109823) https://github.com/pytorch/pytorch/pull/108351/files is failing on mac and windows because we don't have the dependency It is available on linux because it is included in .ci/docker/requirements-docs.txt Adding skips to make it green. Here are some outputs for future debugging https://github.com/pytorch/pytorch/actions/runs/6192933622/job/16813841625 https://ossci-raw-job-status.s3.amazonaws.com/log/16813841625 ``` 2023-09-15T02:09:43.2397460Z =================================== FAILURES =================================== 2023-09-15T02:09:43.2397650Z ______________________ TestTensorBoardSummary.test_audio _______________________ 2023-09-15T02:09:43.2397830Z Traceback (most recent call last): 2023-09-15T02:09:43.2398090Z File "/Users/ec2-user/runner/_work/pytorch/pytorch/test/test_tensorboard.py", line 417, in test_audio 2023-09-15T02:09:43.2398390Z self.assertTrue(compare_proto(summary.audio('dummy', tensor_N(shape=(42,))), self)) 2023-09-15T02:09:43.2398720Z File "/Users/ec2-user/runner/_work/_temp/conda_environment_6192933622/lib/python3.9/unittest/case.py", line 688, in assertTrue 2023-09-15T02:09:43.2399100Z ##[endgroup] 2023-09-15T02:09:43.2399240Z raise self.failureException(msg) 2023-09-15T02:09:43.2399400Z AssertionError: False is not true 2023-09-15T02:09:43.2399490Z 2023-09-15T02:09:43.2399590Z To execute this test, run the following from the base repo dir: 2023-09-15T02:09:43.2399820Z python test/test_tensorboard.py -k test_audio 2023-09-15T02:09:43.2399930Z ``` https://github.com/pytorch/pytorch/actions/runs/6192933622/job/16814065258 https://ossci-raw-job-status.s3.amazonaws.com/log/16814065258 ``` 2023-09-15T02:38:44.6284979Z ================================== FAILURES =================================== 2023-09-15T02:38:44.6285295Z ______________________ TestTensorBoardNumpy.test_scalar _______________________ 2023-09-15T02:38:44.6285556Z Traceback (most recent call last): 2023-09-15T02:38:44.6285915Z File "C:\actions-runner\_work\pytorch\pytorch\test\test_tensorboard.py", line 794, in test_scalar 2023-09-15T02:38:44.6286325Z res = make_np(np.float128(1.00008 + 9)) 2023-09-15T02:38:44.6286705Z File "C:\Jenkins\Miniconda3\lib\site-packages\numpy\__init__.py", line 315, in __getattr__ 2023-09-15T02:38:44.6287700Z raise AttributeError("module {!r} has no attribute " 2023-09-15T02:38:44.6288060Z AttributeError: module 'numpy' has no attribute 'float128' 2023-09-15T02:38:44.6288241Z 2023-09-15T02:38:44.6288390Z To execute this test, run the following from the base repo dir: 2023-09-15T02:38:44.6288679Z python test\test_tensorboard.py -k test_scalar 2023-09-15T02:38:44.6288846Z ``` https://github.com/pytorch/pytorch/actions/runs/6193449301/job/16815113985 https://ossci-raw-job-status.s3.amazonaws.com/log/16815113985 ``` 2023-09-15T03:25:53.7797550Z =================================== FAILURES =================================== 2023-09-15T03:25:53.7797790Z __________________ TestTensorBoardSummary.test_histogram_auto __________________ 2023-09-15T03:25:53.7798000Z Traceback (most recent call last): 2023-09-15T03:25:53.7798310Z File "/Users/ec2-user/runner/_work/pytorch/pytorch/test/test_tensorboard.py", line 426, in test_histogram_auto 2023-09-15T03:25:53.7798690Z self.assertTrue(compare_proto(summary.histogram('dummy', tensor_N(shape=(1024,)), bins='auto', max_bins=5), self)) 2023-09-15T03:25:53.7799090Z File "/Users/ec2-user/runner/_work/_temp/conda_environment_6193449301/lib/python3.9/unittest/case.py", line 688, in assertTrue 2023-09-15T03:25:53.7799430Z raise self.failureException(msg) 2023-09-15T03:25:53.7799610Z AssertionError: False is not true 2023-09-15T03:25:53.7799720Z 2023-09-15T03:25:53.7799840Z To execute this test, run the following from the base repo dir: 2023-09-15T03:25:53.7800170Z python test/test_tensorboard.py -k test_histogram_auto 2023-09-15T03:25:53.7800310Z 2023-09-15T03:25:53.7800430Z This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0 2023-09-15T03:25:53.7800870Z - generated xml file: /Users/ec2-user/runner/_work/pytorch/pytorch/test/test-reports/python-pytest/test_tensorboard/test_tensorboard-aef95b5e2d69c061.xml - 2023-09-15T03:25:53.7801200Z =========================== short test summary info ============================ ``` https://github.com/pytorch/pytorch/actions/runs/6193576371/job/16815396352 https://ossci-raw-job-status.s3.amazonaws.com/log/16815396352 ``` 2023-09-15T03:47:02.9430070Z _________________ TestTensorBoardSummary.test_histogram_doane __________________ 2023-09-15T03:47:02.9430250Z Traceback (most recent call last): 2023-09-15T03:47:02.9430520Z File "/Users/ec2-user/runner/_work/pytorch/pytorch/test/test_tensorboard.py", line 433, in test_histogram_doane 2023-09-15T03:47:02.9430850Z self.assertTrue(compare_proto(summary.histogram('dummy', tensor_N(shape=(1024,)), bins='doane', max_bins=5), self)) 2023-09-15T03:47:02.9431180Z File "/Users/ec2-user/runner/_work/_temp/conda_environment_6193576371/lib/python3.9/unittest/case.py", line 688, in assertTrue 2023-09-15T03:47:02.9431390Z raise self.failureException(msg) 2023-09-15T03:47:02.9431550Z AssertionError: False is not true 2023-09-15T03:47:02.9431640Z 2023-09-15T03:47:02.9431730Z To execute this test, run the following from the base repo dir: 2023-09-15T03:47:02.9432000Z python test/test_tensorboard.py -k test_histogram_doane 2023-09-15T03:47:02.9432120Z ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/109349 Approved by: https://github.com/huydhn (cherry picked from commit 1cc0921eb62089392595264610cfa863d42fe9bc) Co-authored-by: Catherine Lee --- .ci/docker/requirements-ci.txt | 5 +++++ .ci/pytorch/win-test.sh | 2 +- .../requirements/pip-requirements-macOS.txt | 1 + test/test_tensorboard.py | 18 +++++++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.ci/docker/requirements-ci.txt b/.ci/docker/requirements-ci.txt index a4672dfbe505..a04575375e92 100644 --- a/.ci/docker/requirements-ci.txt +++ b/.ci/docker/requirements-ci.txt @@ -275,3 +275,8 @@ z3-solver==4.12.2.0 #Description: The Z3 Theorem Prover Project #Pinned versions: #test that import: + +tensorboard==2.13.0 +#Description: Also included in .ci/docker/requirements-docs.txt +#Pinned versions: +#test that import: test_tensorboard diff --git a/.ci/pytorch/win-test.sh b/.ci/pytorch/win-test.sh index 99338313ad84..5d8cc24e4455 100755 --- a/.ci/pytorch/win-test.sh +++ b/.ci/pytorch/win-test.sh @@ -35,7 +35,7 @@ if [[ "$BUILD_ENVIRONMENT" == *cuda* ]]; then fi # TODO: Move both of them to Windows AMI -python -m pip install pytest-rerunfailures==10.3 pytest-cpp==2.3.0 +python -m pip install pytest-rerunfailures==10.3 pytest-cpp==2.3.0 tensorboard==2.13.0 # Install Z3 optional dependency for Windows builds. python -m pip install z3-solver diff --git a/.github/requirements/pip-requirements-macOS.txt b/.github/requirements/pip-requirements-macOS.txt index f33d37f1c61e..696d2f3dac2c 100644 --- a/.github/requirements/pip-requirements-macOS.txt +++ b/.github/requirements/pip-requirements-macOS.txt @@ -25,3 +25,4 @@ sympy==1.11.1 pytest-cpp==2.3.0 rockset==1.0.3 z3-solver==4.12.2.0 +tensorboard==2.13.0 diff --git a/test/test_tensorboard.py b/test/test_tensorboard.py index 82192aab6ce1..aa9517889ab0 100644 --- a/test/test_tensorboard.py +++ b/test/test_tensorboard.py @@ -43,7 +43,14 @@ skipIfNoMatplotlib = unittest.skipIf(not TEST_MATPLOTLIB, "no matplotlib") import torch -from torch.testing._internal.common_utils import TestCase, run_tests, TEST_WITH_ASAN, TEST_WITH_CROSSREF +from torch.testing._internal.common_utils import ( + TestCase, + run_tests, + TEST_WITH_ASAN, + TEST_WITH_CROSSREF, + IS_WINDOWS, + IS_MACOS, +) def tensor_N(shape, dtype=float): numel = np.prod(shape) @@ -406,18 +413,23 @@ def test_video(self): summary.video('dummy', np.random.rand(16, 48, 1, 28, 28)) summary.video('dummy', np.random.rand(20, 7, 1, 8, 8)) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_audio(self): self.assertTrue(compare_proto(summary.audio('dummy', tensor_N(shape=(42,))), self)) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_text(self): self.assertTrue(compare_proto(summary.text('dummy', 'text 123'), self)) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_histogram_auto(self): self.assertTrue(compare_proto(summary.histogram('dummy', tensor_N(shape=(1024,)), bins='auto', max_bins=5), self)) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_histogram_fd(self): self.assertTrue(compare_proto(summary.histogram('dummy', tensor_N(shape=(1024,)), bins='fd', max_bins=5), self)) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_histogram_doane(self): self.assertTrue(compare_proto(summary.histogram('dummy', tensor_N(shape=(1024,)), bins='doane', max_bins=5), self)) @@ -488,6 +500,7 @@ def test_hparams_domain_discrete(self): # only smoke test. Because protobuf map serialization is nondeterministic. summary.hparams(hp, mt, hparam_domain_discrete=hp_domain) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_mesh(self): v = np.array([[[1, 1, 1], [-1, -1, 1], [1, -1, -1], [-1, 1, -1]]], dtype=float) c = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 0, 255]]], dtype=int) @@ -495,6 +508,7 @@ def test_mesh(self): mesh = summary.mesh('my_mesh', vertices=v, colors=c, faces=f, config_dict=None) self.assertTrue(compare_proto(mesh, self)) + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_scalar_new_style(self): scalar = summary.scalar('test_scalar', 1.0, new_style=True) self.assertTrue(compare_proto(scalar, self)) @@ -777,6 +791,8 @@ def test_figure_list(self): writer.close() class TestTensorBoardNumpy(BaseTestCase): + @unittest.skipIf(IS_WINDOWS, "Skipping on windows, see https://github.com/pytorch/pytorch/pull/109349 ") + @unittest.skipIf(IS_MACOS, "Skipping on mac, see https://github.com/pytorch/pytorch/pull/109349 ") def test_scalar(self): res = make_np(1.1) self.assertIsInstance(res, np.ndarray) and self.assertEqual(res.shape, (1,))