threestudio-project / threestudio

A unified framework for 3D content generation.
Apache License 2.0
6.32k stars 480 forks source link

Failed to specify different textual prompt for different view. #287

Closed yanjk3 closed 1 year ago

yanjk3 commented 1 year ago

I run the command below, and the error occurs.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt_front="aaa" \
    system.prompt_processor.prompt_side="bbb" \
    system.prompt_processor.prompt_back="ccc" \
    system.prompt_processor.prompt_overhead="ddd"
Traceback (most recent call last):
  File "/home/threestudio-main/launch.py", line 237, in <module>
    main(args, extras)
  File "/home/threestudio-main/launch.py", line 99, in main
    cfg = load_config(args.config, cli_args=extras, n_gpus=n_gpus)
  File "/home/threestudio-main/threestudio/utils/config.py", line 108, in load_config
    scfg = parse_structured(ExperimentConfig, cfg)
  File "/home/threestudio-main/threestudio/utils/config.py", line 122, in parse_structured
    scfg = OmegaConf.structured(fields(**cfg))
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 375, in __getitem__
    self._format_and_raise(key=key, value=None, cause=e)
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/base.py", line 231, in _format_and_raise
    format_and_raise(
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/_utils.py", line 899, in format_and_raise
    _raise(ex, cause)
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/_utils.py", line 797, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set env var OC_CAUSE=1 for full trace
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 369, in __getitem__
    return self._get_impl(key=key, default_value=_DEFAULT_MARKER_)
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 451, in _get_impl
    return self._resolve_with_default(
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/basecontainer.py", line 96, in _resolve_with_default
    raise MissingMandatoryValue("Missing mandatory value: $FULL_KEY")
omegaconf.errors.MissingMandatoryValue: Missing mandatory value: tag
    full_key: tag
    object_type=dict

And if I do not specify the view prompt, it works. For example, the below command works.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt="aaa" 

How can I use the view-specific prompts? Thanks in advance : )

thuliu-yt16 commented 1 year ago

The prompt will be used for the tag. So please also specify the prompt although it may be covered by other view-dependent prompts. E.g.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt_front="front" \
    system.prompt_processor.prompt_side="side" \
    system.prompt_processor.prompt_back="back" \
    system.prompt_processor.prompt_overhead="overhead" \
    system.prompt_processor.prompt="foobar"
yanjk3 commented 1 year ago

The prompt will be used for the tag. So please also specify the prompt although it may be covered by other view-dependent prompts. E.g.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt_front="front" \
    system.prompt_processor.prompt_side="side" \
    system.prompt_processor.prompt_back="back" \
    system.prompt_processor.prompt_overhead="overhead" \
    system.prompt_processor.prompt="foobar"

It works, thanks a lot ~

onevfall commented 9 months ago

I run the command below, and the error occurs.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt_front="aaa" \
    system.prompt_processor.prompt_side="bbb" \
    system.prompt_processor.prompt_back="ccc" \
    system.prompt_processor.prompt_overhead="ddd"
Traceback (most recent call last):
  File "/home/threestudio-main/launch.py", line 237, in <module>
    main(args, extras)
  File "/home/threestudio-main/launch.py", line 99, in main
    cfg = load_config(args.config, cli_args=extras, n_gpus=n_gpus)
  File "/home/threestudio-main/threestudio/utils/config.py", line 108, in load_config
    scfg = parse_structured(ExperimentConfig, cfg)
  File "/home/threestudio-main/threestudio/utils/config.py", line 122, in parse_structured
    scfg = OmegaConf.structured(fields(**cfg))
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 375, in __getitem__
    self._format_and_raise(key=key, value=None, cause=e)
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/base.py", line 231, in _format_and_raise
    format_and_raise(
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/_utils.py", line 899, in format_and_raise
    _raise(ex, cause)
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/_utils.py", line 797, in _raise
    raise ex.with_traceback(sys.exc_info()[2])  # set env var OC_CAUSE=1 for full trace
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 369, in __getitem__
    return self._get_impl(key=key, default_value=_DEFAULT_MARKER_)
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/dictconfig.py", line 451, in _get_impl
    return self._resolve_with_default(
  File "/home/anaconda3/envs/3d/lib/python3.9/site-packages/omegaconf/basecontainer.py", line 96, in _resolve_with_default
    raise MissingMandatoryValue("Missing mandatory value: $FULL_KEY")
omegaconf.errors.MissingMandatoryValue: Missing mandatory value: tag
    full_key: tag
    object_type=dict

And if I do not specify the view prompt, it works. For example, the below command works.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt="aaa" 

How can I use the view-specific prompts? Thanks in advance : )

The prompt will be used for the tag. So please also specify the prompt although it may be covered by other view-dependent prompts. E.g.

python launch.py --config configs/dreamfusion-sd.yaml --train --gpu 0 \
    system.prompt_processor.prompt_front="front" \
    system.prompt_processor.prompt_side="side" \
    system.prompt_processor.prompt_back="back" \
    system.prompt_processor.prompt_overhead="overhead" \
    system.prompt_processor.prompt="foobar"

But what do view-specific prompts use for? For example, prompt_front in the project isn't quoted anywhere. Any examples for me could help.

yanjk3 commented 9 months ago

@onevfall here read this function carefully, and you will find the answer.