Updated federated learning project for CPU compatibility and library upgrades #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this Pull Request, the following changes have been made to improve CPU compatibility and upgrade the library versions used in the project:
Library Version Upgrades:
The libraries used in the requirments.txt file have been upgraded to newer versions. Key updates include:
PyTorch has been updated from version 1.2.0 to a more recent version that is compatible with modern environments.
Torchvision and other dependencies have also been upgraded to the latest versions.
The tensorboardX library has been replaced with torch.utils.tensorboard to ensure compatibility with the new version of PyTorch.
CPU Compatibility:
The project has been optimized to run on systems that only have a CPU, rather than requiring a GPU by default.
In the files federated_main.py and update.py, the device handling has been modified to use cpu instead of cuda.
Ensured that the model and data are correctly transferred to the appropriate device (CPU) using global_model.to(device) and model.to(device) in all relevant parts of the code.
Fixing PyTorch Warnings:
Adjustments were made to the use of torch.tensor() to address warnings related to newer versions of PyTorch, such as recommending .clone().detach() for tensor construction.
Tuning Learning Rate and Other Parameters:
The learning rate and training parameters were adjusted to ensure optimal performance in environments without GPU access, such as running the project on Google Colab with CPU.
Avoiding Issues Related to Missing NVIDIA Drivers:
The project was modified to run solely on CPU, which eliminates errors related to missing CUDA or NVIDIA drivers that could occur on systems without GPU support.
These changes allow the project to:
Run smoothly in modern environments with the updated versions of PyTorch and other libraries.
Execute on CPU without requiring a GPU, fixing any issues related to CUDA or NVIDIA driver dependencies.
Please review these changes and, if approved, merge them into the main repository.