instruction-tuned-sd icon indicating copy to clipboard operation
instruction-tuned-sd copied to clipboard

Facing issue While running below code

Open savank7 opened this issue 1 year ago • 4 comments

Hello @sayakpaul I am using a repository and encountered an issue when running the following code. Can you help me resolve it? I have used a sample prompt instead of an actual prompt.

Code

!export MODEL_ID="timbrooks/instruct-pix2pix"
!export DATASET_ID="test/project"
!export OUTPUT_DIR="project"

!accelerate launch --mixed_precision="fp16" finetune_instruct_pix2pix.py \
  --pretrained_model_name_or_path=$MODEL_ID \
  --dataset_name=$DATASET_ID \
  --original_image_column="input_image" \
  --edit_prompt_column="instruction" \
  --edited_image_column="ground_truth_image" \
  --use_ema \
  --enable_xformers_memory_efficient_attention \
  --resolution=256 --random_flip \
  --train_batch_size=2 --gradient_accumulation_steps=4 --gradient_checkpointing \
  --max_train_steps=15000 \
  --checkpointing_steps=5000 --checkpoints_total_limit=1 \
  --learning_rate=5e-05 --lr_warmup_steps=0 \
  --mixed_precision=fp16 \
  --val_image_url="https://hf.co/datasets/sayakpaul/sample-datasets/resolve/main/derain_the_image_1.png" \
  --validation_prompt="sample prompt" \
  --seed=42 \
  --output_dir=$OUTPUT_DIR \
  --report_to=wandb \
  --push_to_hub

Error:

2024-11-29 11:31:50.496573: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-11-29 11:31:50.515545: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-11-29 11:31:50.521837: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-11-29 11:31:50.535619: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-11-29 11:31:51.548235: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
11/29/2024 11:31:53 - INFO - __main__ - Distributed environment: NO
Num processes: 1
Process index: 0
Local process index: 0
Device: cuda

Mixed precision type: fp16

Traceback (most recent call last):
  File "/content/instruction-tuned-sd/finetune_instruct_pix2pix.py", line 1137, in <module>
    main()
  File "/content/instruction-tuned-sd/finetune_instruct_pix2pix.py", line 506, in main
    create_repo(repo_name, exist_ok=True, token=args.hub_token)
  File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 106, in _inner_fn
    validate_repo_id(arg_value)
  File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 160, in validate_repo_id
    raise HFValidationError(
huggingface_hub.errors.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'test/'.
Traceback (most recent call last):
  File "/usr/local/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/accelerate_cli.py", line 48, in main
    args.func(args)
  File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 1168, in launch_command
    simple_launcher(args)
  File "/usr/local/lib/python3.10/dist-packages/accelerate/commands/launch.py", line 763, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'finetune_instruct_pix2pix.py', '--pretrained_model_name_or_path=', '--dataset_name=', '--original_image_column=input_image', '--edit_prompt_column=instruction', '--edited_image_column=ground_truth_image', '--use_ema', '--enable_xformers_memory_efficient_attention', '--resolution=256', '--random_flip', '--train_batch_size=2', '--gradient_accumulation_steps=4', '--gradient_checkpointing', '--max_train_steps=15000', '--checkpointing_steps=5000', '--checkpoints_total_limit=1', '--learning_rate=5e-05', '--lr_warmup_steps=0', '--mixed_precision=fp16', '--val_image_url=https://hf.co/datasets/sayakpaul/sample-datasets/resolve/main/derain_the_image_1.png', '--validation_prompt=sample prompt', '--seed=42', '--output_dir=', '--report_to=wandb', '--push_to_hub']' returned non-zero exit status 1.

savank7 avatar Nov 29 '24 11:11 savank7

huggingface_hub.errors.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'test/'.

sayakpaul avatar Nov 29 '24 11:11 sayakpaul

huggingface_hub.errors.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'test/'.

@sayakpaul We tried every possible combination of Repo ID but still the same error.

savank7 avatar Nov 29 '24 13:11 savank7

I tried with test-123 and it worked.

sayakpaul avatar Nov 29 '24 13:11 sayakpaul

can you try by doing :

! export MODEL_ID="timbrooks/instruct-pix2pix" && \
export DATASET_ID="test/project" && \
export OUTPUT_DIR="project" && \
accelerate launch --mixed_precision="fp16" finetune_instruct_pix2pix.py \
  --pretrained_model_name_or_path=$MODEL_ID \
.....

adding this : && \

ViCtOr-dev13 avatar Feb 05 '25 10:02 ViCtOr-dev13