FedML-AI / FedML

FEDML - The unified and scalable ML library for large-scale distributed training, model serving, and federated learning. FEDML Launch, a cross-cloud scheduler, further enables running any AI jobs on any GPU cloud or on-premise cluster. Built on this library, TensorOpera AI (https://TensorOpera.ai) is your generative AI platform at scale.
https://TensorOpera.ai
Apache License 2.0
4.2k stars 787 forks source link

[CLI] "fedml build" error on Ubuntu 20.04 #206

Closed FedML-AI-admin closed 2 years ago

FedML-AI-admin commented 2 years ago

fedml login step passed for this particular Ubuntu OS computer.

SOURCE=/home/mpotter/FedML/python/examples/cross_silo/mqtt_s3_fedavg_mnist_lr_example/

ENTRY=torch_client.py

CONFIG=/home/mpotter/FedML/python/examples/cross_silo/mqtt_s3_fedavg_mnist_lr_example/step_by_step/config

DEST=./mlops

fedml build -t client -sf $SOURCE -ep $ENTRY -cf $CONFIG -df $DEST

ENTRY=torch_server.py

fedml build -t server -sf $SOURCE -ep $ENTRY -cf $CONFIG -df $DEST

Actually I think I see the mistake, I did not include step_by_step in source path. I will try again.

Now this error occurs when I fix the source path SOURCE=/home/mpotter/FedML/python/examples/cross_silo/mqtt_s3_fedavg_mnist_lr_example/step_by_stepand try to run fedml build again.

fedml build -t client -sf $SOURCE -ep $ENTRY -cf $CONFIG -df $DEST Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 key Argument for type: client Argument for source folder: /home/mpotter/FedML/python/examples/cross_silo/mqtt_s3_fedavg_mnist_lr_example/step_by_step Argument for entry point: torch_client.py Argument for config folder: /home/mpotter/FedML/python/examples/cross_silo/mqtt_s3_fedavg_mnist_lr_example/step_by_step/config Argument for destination package folder: ./mlops Now, you are building the fedml packages which will be used in the MLOps platform. The packages will be used for client training and server aggregation. When the building process is completed, you will find the packages in the directory as follows: ./mlops/dist-packages. Then you may upload the packages on the configuration page in the MLOps platform to start the federated learning flow. Building... Traceback (most recent call last): File "/home/mpotter/anaconda3/envs/fedml/bin/fedml", line 8, in sys.exit(cli()) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/cli/cli.py", line 85, in mlops_build "fedml-client", "client-package", "${FEDSYS.CLIENT_INDEX}") File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/cli/cli.py", line 117, in build_mlops_package shutil.copytree(mlops_conf, mlops_dest_conf, copy_function=shutil.copy) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/shutil.py", line 324, in copytree os.makedirs(dst) File "/home/mpotter/anaconda3/envs/fedml/lib/python3.7/os.py", line 223, in makedirs mkdir(name, mode) FileExistsError: [Errno 17] File exists: '/home/mpotter/anaconda3/envs/fedml/lib/python3.7/site-packages/fedml/cli/build-package/mlops-core/fedml-client/client-package/fedml/config'

chaoyanghe commented 2 years ago

'Arguments' object has no attribute 'using_mlops'“

mlpotter commented 2 years ago

Resolve issue by removing the directory if it exists, since shutil.copytree throws exception if directory pre-exists.

Lines 115 in cli/cli.py

    if os.path.exists(mlops_dest) and os.path.isdir(mlops_dest):
        shutil.rmtree(mlops_dest)
    shutil.copytree(mlops_src, mlops_dest, copy_function=shutil.copy)
    if os.path.exists(mlops_dest_conf) and os.path.isdir(mlops_dest_conf):
        shutil.rmtree(mlops_dest_conf)
    shutil.copytree(mlops_conf, mlops_dest_conf, copy_function=shutil.copy)
chaoyanghe commented 2 years ago

Resolve issue by removing the directory if it exists, since shutil.copytree throws exception if directory pre-exists.

Lines 115 in cli/cli.py

    if os.path.exists(mlops_dest) and os.path.isdir(mlops_dest):
        shutil.rmtree(mlops_dest)
    shutil.copytree(mlops_src, mlops_dest, copy_function=shutil.copy)
    if os.path.exists(mlops_dest_conf) and os.path.isdir(mlops_dest_conf):
        shutil.rmtree(mlops_dest_conf)
    shutil.copytree(mlops_conf, mlops_dest_conf, copy_function=shutil.copy)

Thank you. We will fix this issue soon.