TypeError: __init__() takes from 1 to 4 positional arguments but 5 were given
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 765
- PR merge metrics
- No merged PRs in 30d
Description
When i'm running sp_fedavg_mnist_lr_example following the tutorial (https://github.com/FedML-AI/FedML/blob/master/doc/en/simulation/examples/sp_fedavg_mnist_lr_example.md), I meet this ERROR.
Just after
`python torch_fedavg_mnist_lr_one_line_example.py --cf fedml_config.yaml`
It says
```
======== FedML (https://fedml.ai) ========
FedML version: 0.8.5
Execution path:/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/__init__.py
======== Running Environment ========
OS: Linux-5.19.0-46-generic-x86_64-with-debian-bookworm-sid
Hardware: x86_64
Python version: 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0]
PyTorch version: 1.13.1+cu117
MPI4py is installed
======== CPU Configuration ========
The CPU usage is : 4%
Available CPU Memory: 12.1 G / 15.481403350830078G
======== GPU Configuration ========
NVIDIA GPU Info:
Available GPU memory: 5.7 G / 6.0G
torch_is_available = True
device_count = 1
device_name = NVIDIA GeForce RTX 2060
======== Network Connection Checking ========
The connection to https://open.fedml.ai is OK.
/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/boto3/compat.py:82: PythonDeprecationWarning: Boto3 will no longer support Python 3.7 starting December 13, 2023. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.8 or later. More information can be found here: https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/
warnings.warn(warning, PythonDeprecationWarning)
The connection to AWS S3 is OK.
The connection to mqtt.fedml.ai (port:1883) is OK.
using_mlops = true
ERROR:root:Uncaught exception
Traceback (most recent call last):
File "torch_fedavg_mnist_lr_one_line_example.py", line 5, in
fedml.run_simulation()
File "/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/launch_simulation.py", line 16, in run_simulation
args = fedml.init()
File "/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/__init__.py", line 98, in init
mlops.init(args)
File "/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/mlops/__init__.py", line 12, in init
mlops.init(args)
File "/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/core/mlops/__init__.py", line 86, in init
MLOpsRuntimeLog.get_instance(args).init_logs()
File "/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/core/mlops/mlops_runtime_log.py", line 132, in init_logs
datefmt="%a, %d %b %Y %H:%M:%S")
File "/home/ww/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/core/mlops/mlops_runtime_log.py", line 109, in __init__
super().__init__(fmt, datefmt, style, validate)
TypeError: __init__() takes from 1 to 4 positional arguments but 5 were given
```
And my fedml_config.yaml is
```
common_args:
training_type: "simulation"
random_seed: 0
config_version: "release"
mlops_api_key: f5b88f5dca344e6faf17809139b89c48
mlops_project_name: sp_fedavg_test
mlops_run_name: fedml_torch_fedavg_mnist_lr_mlsys
data_args:
dataset: "mnist"
data_cache_dir: ~/Documents/FedML/python/fedml/data/MNIST #~/fedml_data
partition_method: "hetero"
partition_alpha: 0.5
model_args:
model: "lr"
train_args:
federated_optimizer: "FedAvg"
client_id_list: "[]"
client_num_in_total: 1000
client_num_per_round: 10
comm_round: 200 # 3 is for quick GitHub sanity check. please change this to your own hyper-parameters (e.g., 200)
epochs: 1
batch_size: 10
client_optimizer: sgd
learning_rate: 0.03
weight_decay: 0.001
validation_args:
frequency_of_the_test: 5
device_args:
using_gpu: false
gpu_id: 0
comm_args:
backend: "sp"
tracking_args:
log_file_dir: ./log
enable_tracking: false
# When running on MLOps platform(open.fedml.ai), the default log path is at ~/fedml-client/fedml/logs/ and ~/fedml-server/fedml/logs/
enable_wandb: false
wandb_key: ee0b5f53d949c84cee7decbe7a629e63fb2f8408
wandb_entity: fedml-ai
wandb_project: simulation
run_name: fedml_torch_fedavg_mnist_lr
using_mlops: true
```
What should i do ?
Contributor guide
Assessment
This issue has not been assessed yet.