Skip to content

Commit

Permalink
pin nummpy correct for mac arm64, x86x64, python3.8-3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasakesson committed Oct 1, 2024
1 parent 8cd97b8 commit f4cf190
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/monai-2D-mednist/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- torch==2.2.2; sys_platform == "darwin" and platform_machine == "x86_64"
- torchvision==0.19.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win32" or sys_platform == "win64" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy<2; (sys_platform == "darwin" and platform_machine == "arm64" and python_version >= "3.9") or (sys_platform == "win" or sys_platform == "linux" and python_version >= "3.9")
- numpy==1.26.4; (sys_platform == "darwin" and platform_machine == "arm64" and python_version >= "3.9") or (sys_platform == "win" or sys_platform == "linux" and python_version >= "3.9")
- numpy==1.26.4; (sys_platform == "darwin" and platform_machine == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
- monai-weekly[pillow, tqdm]
Expand Down
3 changes: 1 addition & 2 deletions examples/monai-2D-mednist/client/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def train(in_model_path, out_model_path, data_path=None, client_settings_path=No
clients = yaml.safe_load(file)

image_list = clients["client " + str(split_index)]["train"]

train_ds = MedNISTDataset(data_path=data_path+"/MedNIST/", transforms=train_transforms, image_files=image_list)
train_loader = DataLoader(train_ds, batch_size=batch_size, shuffle=True, num_workers=num_workers)

Expand Down Expand Up @@ -101,7 +100,7 @@ def train(in_model_path, out_model_path, data_path=None, client_settings_path=No
loss.backward()
optimizer.step()
epoch_loss += loss.item()
print(f"{step}/{len(train_loader) // train_loader.batch_size}, " f"train_loss: {loss.item():.4f}")
print(f"{step}/{len(train_loader)}, " f"train_loss: {loss.item():.4f}")

epoch_loss /= step
epoch_loss_values.append(epoch_loss)
Expand Down
4 changes: 3 additions & 1 deletion examples/monai-2D-mednist/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
monai
PyYAML
numpy==1.26.4
numpy==1.26.4; (sys_platform == "darwin" and platform_machine == "arm64" and python_version >= "3.9") or (sys_platform == "win" or sys_platform == "linux" and python_version >= "3.9")
numpy==1.26.4; (sys_platform == "darwin" and platform_machine == "x86_64" and python_version >= "3.9")
numpy==1.24.4; python_version == "3.8"

0 comments on commit f4cf190

Please sign in to comment.