Skip to content

Accelerator.init_trackers error when deal with a custom object of list #3727

@micklexqg

Description

@micklexqg

System Info

🤗 Diffusers version: 0.33.0.dev0
    Platform: Linux-6.8.0-55-generic-x86_64-with-glibc2.39
    Running on Google Colab?: No
    Python version: 3.10.11
    PyTorch version (GPU?): 2.7.1+cu126 (True)
    Flax version (CPU?/GPU?/TPU?): not installed (NA)
    Jax version: not installed
    JaxLib version: not installed
    Huggingface_hub version: 0.30.1
    Transformers version: 4.52.4
    Accelerate version: 1.8.1
    PEFT version: 0.15.2
    Bitsandbytes version: 0.45.4
    Safetensors version: 0.5.3
    xFormers version: 0.0.27.post2
    Accelerator: NVIDIA GeForce RTX 3090, 24576 MiB
    Using GPU in script?:
    Using distributed or parallel set-up in script?:

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • One of the scripts in the examples/ folder of Accelerate or an officially supported no_trainer script in the examples folder of the transformers repo (such as run_no_trainer_glue.py)
  • My own task or dataset (give details below)

Reproduction

  1. set the follow argument in "train_dreambooth.py" or other similar demos such as "train_amused.py":
    parser.add_argument( "--validation_prompt", type=str, default=["A photo of sks dog in a bucket", "A sks cat wearing a coat"], nargs="*", help="A prompt that is used during validation to verify that the model is learning.", )
  2. An error occured at if accelerator.is_main_process: tracker_name = "dreambooth-lora" accelerator.init_trackers(tracker_name, config=vars(args)) with
    "ValueError: value should be one of int, float, str, bool, or torch.Tensor"

Expected behavior

I set multiple prompts with nargs for argument "--validation_prompt " in "train_dreambooth.py":

parser.add_argument( "--validation_prompt", type=str, default=["A photo of sks dog in a bucket", "A sks cat wearing a coat"], nargs="*", help="A prompt that is used during validation to verify that the model is learning.", )
but an error occured at if accelerator.is_main_process: tracker_name = "dreambooth-lora" accelerator.init_trackers(tracker_name, config=vars(args))
with "ValueError: value should be one of int, float, str, bool, or torch.Tensor".
Is it because tensorboard only support basic Python types and PyTorch tensors but not a custom object such as list?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions