Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 52f5030

Browse files
committed
print non-existence image prompt
1 parent 76c1cd2 commit 52f5030

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

assets/view.jpg

93.3 KB
Loading

torchchat/generate.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,11 @@ def from_args(cls, args):
179179

180180
# Validate that all image prompts exist before expensive model load
181181
if image_prompts := getattr(args, "image_prompts", None):
182-
if not all(os.path.exists(image_prompt) for image_prompt in image_prompts):
183-
raise RuntimeError(f"Image prompt {image_prompt} does not exist")
182+
non_existent_image_prompts = [
183+
image_prompt if (not os.path.exists(image_prompt)) for image_prompt in image_prompts
184+
]
185+
if len(non_existent_image_prompts):
186+
raise RuntimeError(f"Image prompt {non_existent_image_prompts} does not exist")
184187

185188
return cls(
186189
prompt=getattr(args, "prompt", ""),
@@ -938,7 +941,7 @@ def chat(
938941
TransformerCrossAttentionLayer,
939942
TransformerSelfAttentionLayer,
940943
)
941-
decoder = self.model.model.decoder
944+
decoder = self.model.model.decoder
942945
for m in reversed(list(decoder.modules())):
943946
if isinstance(m, TransformerSelfAttentionLayer) or isinstance(
944947
m, TransformerCrossAttentionLayer

0 commit comments

Comments
 (0)