Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05091d4

Browse files
authored
[Test][Transformer] Pre-parse container version (#1673)
* pre-parse container version * check torch version first
1 parent ecb5614 commit 05091d4

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/L0/run_transformer/test_pipeline_parallel_fwd_bwd.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
import itertools
44
import os
5+
from datetime import datetime
56
from packaging.version import parse, Version
67
import re
78
from typing import Optional, Tuple, List
@@ -40,11 +41,19 @@
4041
weight_coeff = 1024
4142

4243
# Guard for https://github.com/pytorch/pytorch/pull/82450
44+
def get_nvidia_pytorch_version():
45+
ver = os.getenv("NVIDIA_PYTORCH_VERSION", "22.08")
46+
if "master" in ver:
47+
ver = datetime.today().strftime("%y.%m")
48+
elif "update_for_" in ver:
49+
ver = ver.replace("update_for_", "")
50+
return ver
51+
4352
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = False
4453
ngc_container_2209, pytorch_113 = Version("22.09"), Version("1.13")
45-
if parse(os.getenv("NVIDIA_PYTORCH_VERSION", "22.08")) >= ngc_container_2209:
54+
if parse(torch.__version__) >= pytorch_113:
4655
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = True
47-
elif parse(torch.__version__) >= pytorch_113:
56+
elif parse(get_nvidia_pytorch_version()) >= ngc_container_2209:
4857
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = True
4958
else:
5059
CAN_SKIP_SYNC_AFTER_BATCH_ISEND_IRECV = False

0 commit comments

Comments
 (0)