Skip to content

Commit

Permalink
Fix/SK-1025 | Fix torch dependencies based on arch (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrede authored Sep 13, 2024
1 parent ed5ae94 commit a1a8a02
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 22 deletions.
12 changes: 9 additions & 3 deletions examples/FedSimSiam/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ build_dependencies:
- setuptools
- wheel==0.37.1
dependencies:
- torch==2.2.0
- torchvision==0.17.0
- fedn==0.9.0
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
# PyTorch macOS x86 builds deprecation
- 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 == "win" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.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 == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
- fedn
12 changes: 9 additions & 3 deletions examples/flower-client/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ build_dependencies:
- setuptools
- wheel==0.37.1
dependencies:
- torch==2.2.1
- torchvision==0.17.1
- fedn[flower]
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
# PyTorch macOS x86 builds deprecation
- 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 == "win" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.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 == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
- fire==0.3.1
- fedn[flower]==0.9.0
- flwr-datasets[vision]==0.1.0
11 changes: 8 additions & 3 deletions examples/huggingface/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ build_dependencies:
- setuptools
- wheel
dependencies:
- numpy==2.0.2
- torch==2.4.1
- torchvision==0.19.1
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
# PyTorch macOS x86 builds deprecation
- 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 == "win" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.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 == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
- transformers
- datasets
- fedn
7 changes: 4 additions & 3 deletions examples/mnist-pytorch-DPSGD/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ build_dependencies:
- wheel
dependencies:
- fedn
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
# PyTorch macOS x86 builds deprecation
- 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 == "win" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.2; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
- numpy==1.26.4; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.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 == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
- opacus
10 changes: 8 additions & 2 deletions examples/mnist-pytorch/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ build_dependencies:
- setuptools
- wheel
dependencies:
- torch
- torchvision
- fedn
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
# PyTorch macOS x86 builds deprecation
- 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 == "win" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.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 == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
11 changes: 8 additions & 3 deletions examples/monai-2D-mednist/client/python_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ build_dependencies:
- setuptools
- wheel
dependencies:
- torch==2.2.1
- torchvision==0.17.1
- fedn
- torch==2.4.1; (sys_platform == "darwin" and platform_machine == "arm64") or (sys_platform == "win" or sys_platform == "linux")
# PyTorch macOS x86 builds deprecation
- 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 == "win" or sys_platform == "linux")
- torchvision==0.17.2; sys_platform == "darwin" and platform_machine == "x86_64"
- numpy==2.0.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 == "x86_64" and python_version >= "3.9")
- numpy==1.24.4; python_version == "3.8"
- monai-weekly[pillow, tqdm]
- numpy==1.26.4
- scikit-learn
2 changes: 1 addition & 1 deletion fedn/network/combiner/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
network_id = get_network_config()

statestore = MongoStateStore(network_id, statestore_config["mongo_config"])
repository = Repository(modelstorage_config["storage_config"])
repository = Repository(modelstorage_config["storage_config"], init_buckets=False)

modelservice = ModelService()
9 changes: 5 additions & 4 deletions fedn/network/storage/s3/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Repository:
"""Interface for storing model objects and compute packages in S3 compatible storage."""

def __init__(self, config):
def __init__(self, config, init_buckets=True):
self.model_bucket = config["storage_bucket"]
self.context_bucket = config["context_bucket"]
try:
Expand All @@ -19,9 +19,10 @@ def __init__(self, config):
# TODO: Make a plug-in solution
self.client = MINIORepository(config)

self.client.create_bucket(self.context_bucket)
self.client.create_bucket(self.model_bucket)
self.client.create_bucket(self.inference_bucket)
if init_buckets:
self.client.create_bucket(self.context_bucket)
self.client.create_bucket(self.model_bucket)
self.client.create_bucket(self.inference_bucket)

def get_model(self, model_id):
"""Retrieve a model with id model_id.
Expand Down

0 comments on commit a1a8a02

Please sign in to comment.