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

Invalid --gpus argument #27

Open
yu-rp opened this issue Oct 22, 2022 · 7 comments · May be fixed by #34
Open

Invalid --gpus argument #27

yu-rp opened this issue Oct 22, 2022 · 7 comments · May be fixed by #34

Comments

@yu-rp
Copy link

yu-rp commented Oct 22, 2022

Dear author,

I am running the pokemon_finetune.ipynb with the following setting.

# 2xA6000:
BATCH_SIZE = 4
N_GPUS = 1
ACCUMULATE_BATCHES = 1

gpu_list = ",".join((str(x) for x in range(N_GPUS))) + ","
print(f"Using GPUs: {gpu_list}")

I run the python main.py code block

# Run training
!(python main.py \
    -t \
    --base configs/stable-diffusion/pokemon.yaml \
    --gpus "$gpu_list" \
    --scale_lr False \
    --num_nodes 1 \
    --check_val_every_n_epoch 10 \
    --finetune_from "$ckpt_path" \
    data.params.batch_size="$BATCH_SIZE" \
    lightning.trainer.accumulate_grad_batches="$ACCUMULATE_BATCHES" \
    data.params.validation.params.n_gpus="$NUM_GPUS" \
)

I got an error saying that

main.py: error: argument --gpus: invalid _gpus_allowed_type value: ''

Could you please let me know why?

@devonbrackbill
Copy link

You're running with N_GPUS = 1, which creates the string gpu_list='0,', but you want it to be gpu_list='0' (without the trailing comma). You can replace the final two lines of the settings with:

if N_GPUS > 1:
  gpu_list = ",".join((str(x) for x in range(N_GPUS))) + ","
else:
  gpu_list = "0"
print(f"Using GPUs: {gpu_list}")

@mingyao743
Copy link

maybe its code mistake, N_GPUS instead of NUM_GPUS

@Terkwood
Copy link

Terkwood commented Nov 1, 2022

yes, there's a mistake there as pointed out by @mingyao743 . i will raise a PR if there's not one already

@Terkwood Terkwood linked a pull request Nov 1, 2022 that will close this issue
@Terkwood
Copy link

Terkwood commented Nov 1, 2022

Raised #34 to resolve this. This change let me progress on my notebook

@yu-rp
Copy link
Author

yu-rp commented Nov 12, 2022

Thank you all. This also works for me. May I ask whether I shall close this issue?

Raised #34 to resolve this. This change let me progress on my notebook

@MesutUnutur
Copy link

Hello dear,
I got the same error saying that
main.py: error: argument --gpus: invalid _gpus_allowed_type value: ''
now i am using this code block on runpod. i use cloud gpu. How can i fix the same error when i was using cloud cpu?
Thanks for answering

@megatran
Copy link

Hopefully the author will look at the pending PR, but here's a potential fix #65

jaclyngu pushed a commit to jaclyngu/Lambda-Finetune-Diffusion-HUNTR that referenced this issue Jun 23, 2023
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

Successfully merging a pull request may close this issue.

6 participants