pytorch / torchchat

Run PyTorch LLMs locally on servers, desktop and mobile
BSD 3-Clause "New" or "Revised" License
3.4k stars 224 forks source link

raise error with non-existence image prompts #1322

Closed Gasoonjia closed 1 month ago

Gasoonjia commented 1 month ago

Currently image_prompt variable in the error message doesn't exist, blocking error msg to be printed out:

Traceback (most recent call last):
  File "/home/gasoonjia/torchchat/torchchat.py", line 88, in <module>
    generate_main(args)
  File "/home/gasoonjia/torchchat/torchchat/generate.py", line 1249, in main
    generator_args = GeneratorArgs.from_args(args)
  File "/home/gasoonjia/torchchat/torchchat/generate.py", line 184, in from_args
    raise RuntimeError(f"Image prompt {image_prompt} does not exist")
NameError: name 'image_prompt' is not defined. Did you mean: 'image_prompts'?

After this PR:

(torchchat) [gasoonjia ~/torchchat (image-prompt-bug)]$ python torchchat.py generate llama3.2-11B --prompt "What's in this image?" --image-prompt assets/NO_EXIST_IMG.jpg
Traceback (most recent call last):
  File "/home/gasoonjia/torchchat/torchchat.py", line 88, in <module>
    generate_main(args)
  File "/home/gasoonjia/torchchat/torchchat/generate.py", line 1225, in main
    generator_args = GeneratorArgs.from_args(args)
  File "/home/gasoonjia/torchchat/torchchat/generate.py", line 188, in from_args
    raise RuntimeError(
RuntimeError: Image prompt ['assets/NO_EXIST_IMG.jpg'] does not exist
pytorch-bot[bot] commented 1 month ago

:link: Helpful Links

:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchchat/1322

Note: Links to docs will display an error until the docs builds have been completed.

:heavy_exclamation_mark: 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

:white_check_mark: No Failures

As of commit 2f52a9f93149c0566fe2519512e610a5b415614d with merge base 76c1cd24db69fed31c9857d5dc3a958ceed7e066 (image): :green_heart: Looks good so far! There are no failures yet. :green_heart:

This comment was automatically generated by Dr. CI and updates every 15 minutes.