Skip to content

Commit 354d26e

Browse files
d4l3kfacebook-github-bot
authored andcommitted
update to torch 1.11, python 3.10 (#423)
Summary: Now that torch 1.11 is released we should update to it. Also adds python 3.10 support to the unit tests now that torch supports it. Pull Request resolved: #423 Test Plan: CI ``` torchx/runtime/container/build.sh ``` Reviewed By: PaliC Differential Revision: D34903945 Pulled By: d4l3k fbshipit-source-id: ba6be59f2aabac0accd94a9406cae31a43951f1c
1 parent 4cd94d8 commit 354d26e

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

.github/workflows/python-unittests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
unittest:
1111
strategy:
1212
matrix:
13-
python-version: [3.7, 3.8, 3.9]
13+
python-version: [3.7, 3.8, 3.9, '3.10']
1414
platform: [ubuntu-18.04]
1515
include:
1616
- python-version: 3.9

dev-requirements.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ kfp==1.8.9
1212
moto==3.0.2
1313
pyre-extensions==0.0.21
1414
pytest
15-
pytorch-lightning==1.5.6
16-
ray[default]==1.9.2
17-
torch-model-archiver==0.4.2
18-
torch==1.10.0
19-
torchserve==0.4.2
20-
torchtext==0.11.0
21-
torchvision==0.11.1
15+
pytorch-lightning==1.5.10
16+
torch-model-archiver>=0.4.2
17+
torch>=1.10.0
18+
torchserve>=0.4.2
19+
torchtext>=0.11.0
20+
torchvision>=0.11.1
2221
ts==0.5.1
2322
usort==0.6.4
23+
24+
# Ray doesn't support Python 3.10
25+
ray[default]==1.11.0; python_version < '3.10'

torchx/runtime/container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM pytorch/pytorch:1.10.0-cuda11.3-cudnn8-runtime
1+
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
22

33
WORKDIR /app
44

torchx/schedulers/ray/ray_driver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def create_command_actors(
137137

138138
def main() -> None: # pragma: no cover
139139
actors: List[RayActor] = load_actor_json("actors.json")
140+
# pyre-fixme[16]: Module `worker` has no attribute `init`.
140141
ray.init(address="auto", namespace="torchx-ray")
141142
pgs: List[PlacementGroup] = create_placement_groups(actors)
142143
command_actors: List[CommandActor] = create_command_actors(actors, pgs)
@@ -148,6 +149,7 @@ def main() -> None: # pragma: no cover
148149

149150
# Await return result of remote ray function
150151
while len(active_workers) > 0:
152+
# pyre-fixme[16]: Module `worker` has no attribute `wait`.
151153
completed_workers, active_workers = ray.wait(active_workers)
152154
# If a failure occurs the ObjectRef will be marked as completed.
153155
# Calling ray.get will expose the failure as a RayActorError.

torchx/schedulers/test/ray_scheduler_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,14 @@ class RayClusterSetup:
258258
def __new__(cls): # pyre-ignore[3]
259259
if cls._instance is None:
260260
cls._instance = super(RayClusterSetup, cls).__new__(cls)
261+
# pyre-fixme[16]: Module `worker` has no attribute `shutdown`.
261262
ray.shutdown()
262263
start_status: int = os.system("ray start --head")
263264
if start_status != 0:
264265
raise AssertionError(
265266
"ray start --head command has failed. Cannot proceed with running tests"
266267
)
268+
# pyre-fixme[16]: Module `worker` has no attribute `init`.
267269
ray.init(address="auto", ignore_reinit_error=True)
268270
cls.reference_count: int = 2
269271
return cls._instance
@@ -274,6 +276,7 @@ def decrement_reference(cls) -> None:
274276
cls.teardown_ray_cluster()
275277

276278
def teardown_ray_cluster(cls) -> None:
279+
# pyre-fixme[16]: Module `worker` has no attribute `shutdown`.
277280
ray.shutdown()
278281

279282
class RayDriverTest(TestCase):
@@ -306,6 +309,7 @@ class RayIntegrationTest(TestCase):
306309
def test_ray_cluster(self) -> None:
307310
ray_cluster_setup = RayClusterSetup()
308311
ray_scheduler = self.setup_ray_cluster()
312+
# pyre-fixme[16]: Module `worker` has no attribute `is_initialized`.
309313
assert ray.is_initialized() is True
310314

311315
job_id = self.schedule_ray_job(ray_scheduler)

torchx/specs/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def get_type_name(tp: Type[CfgVal]) -> str:
494494
495495
Note: we use this method to print out generic typing like List[str].
496496
"""
497-
if hasattr(tp, "__name__"):
497+
if tp.__module__ != "typing" and hasattr(tp, "__name__"):
498498
return tp.__name__
499499
else:
500500
return str(tp)

0 commit comments

Comments
 (0)