Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Nvidia Torch and Arch versions #9897

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ def check_cuda():
dprops = th.cuda.get_device_properties(cur_device)

is_sm75 = dprops.major == 7 and dprops.minor == 5
is_sm8x = dprops.major == 8 and dprops.minor >= 0
is_sm90 = dprops.major == 9 and dprops.minor >= 0
is_sm8x_or_later = dprops.major >= 8

return is_sm8x or is_sm75 or is_sm90
return is_sm75 or is_sm8x_or_later


try:
Expand Down Expand Up @@ -154,7 +153,9 @@ def __init__(
self.use_scale_shift_norm = use_scale_shift_norm

self.in_layers = nn.Sequential(
normalization(channels), nn.SiLU(), conv_nd(dims, channels, self.out_channels, 3, padding=1),
normalization(channels),
nn.SiLU(),
conv_nd(dims, channels, self.out_channels, 3, padding=1),
)

self.updown = up or down
Expand All @@ -173,7 +174,11 @@ def __init__(
self.h_upd = self.x_upd = nn.Identity()

self.emb_layers = nn.Sequential(
nn.SiLU(), linear(emb_channels, 2 * self.out_channels if use_scale_shift_norm else self.out_channels,),
nn.SiLU(),
linear(
emb_channels,
2 * self.out_channels if use_scale_shift_norm else self.out_channels,
),
)
self.out_layers = nn.Sequential(
normalization(self.out_channels),
Expand Down Expand Up @@ -263,7 +268,11 @@ def __init__(
)

self.emb_layers = nn.Sequential(
nn.SiLU(), nn.Linear(emb_channels, 2 * out_channels if use_scale_shift_norm else out_channels,),
nn.SiLU(),
nn.Linear(
emb_channels,
2 * out_channels if use_scale_shift_norm else out_channels,
),
)

self.out_layers = nn.Sequential(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ def check_cuda():
dprops = torch.cuda.get_device_properties(cur_device)

is_sm75 = dprops.major == 7 and dprops.minor == 5
is_sm8x = dprops.major == 8 and dprops.minor >= 0
is_sm90 = dprops.major == 9 and dprops.minor >= 0
is_sm8x_or_later = dprops.major >= 8

return is_sm8x or is_sm75 or is_sm90
return is_sm75 or is_sm8x_or_later


try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,11 @@ def _enable_nvidia_optimizations(self):
# NVIDIA container version check
nvidia_torch_version = os.getenv('NVIDIA_PYTORCH_VERSION', None)

# Support DLFW master container
if nvidia_torch_version == 'master':
def is_official_release_version(nvidia_torch_version):
return re.fullmatch("[0-9][0-9]\.[0-9][0-9].*", nvidia_torch_version) # "YY.MM.*"

# Support DLFW dev container
if not is_official_release_version(nvidia_torch_version):
nvidia_torch_version = datetime.now().strftime('%y.%m')

if nvidia_torch_version is not None:
Expand All @@ -389,7 +392,7 @@ def _enable_nvidia_optimizations(self):
except Exception:
NVIDIA_TORCH_MAJOR = 0
try:
NVIDIA_TORCH_MINOR = int(nvidia_torch_version.split('.')[1])
NVIDIA_TORCH_MINOR = int(nvidia_torch_version.split('.')[1][:2])
except Exception:
NVIDIA_TORCH_MINOR = 0

Expand Down
Loading