Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finetune.py: proble with local_rank #53

Open
martina811 opened this issue Apr 24, 2024 · 1 comment
Open

finetune.py: proble with local_rank #53

martina811 opened this issue Apr 24, 2024 · 1 comment

Comments

@martina811
Copy link

Hello everyone,
I am facing a problem with the script finetune.py, when I launch the command from the tutorial python -m torch.distributed.launch finetune.py --data_path DATA/Zheng68K.h5ad --model_path DATA/panglao_pretrain.pth , I get the following error:

If your script expects --local-rank argument to be set, please
change it to read from os.environ['LOCAL_RANK'] instead. See
https://pytorch.org/docs/stable/distributed.html#launch-utility for
further instructions

warnings.warn(
usage: finetune.py [-h] [--local_rank LOCAL_RANK] [--bin_num BIN_NUM] [--gene_num GENE_NUM] [--epoch EPOCH] [--seed SEED] [--batch_size BATCH_SIZE]
[--learning_rate LEARNING_RATE] [--grad_acc GRAD_ACC] [--valid_every VALID_EVERY] [--pos_embed POS_EMBED] [--data_path DATA_PATH]
[--model_path MODEL_PATH] [--ckpt_dir CKPT_DIR] [--model_name MODEL_NAME]
finetune.py: error: unrecognized arguments: --local-rank=0

Is there anybody else that faced this problem and fixed it?

Many thanks

@Jiam1ng
Copy link

Jiam1ng commented May 30, 2024

I tried to add the --use_env argument when running the script, and the local-rank error could be solved. For your command, it should be:
python -m torch.distributed.launch --use_env finetune.py --data_path DATA/Zheng68K.h5ad --model_path DATA/panglao_pretrain.pth

In my situation, --local_rank 0 should also be added to the last of the command to run the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants