From 607205211aba8dc907e2cf6d129674bbafaea6e6 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 29 Oct 2025 18:16:40 -0400 Subject: [PATCH] Improve robustness --- chandra/model/vllm.py | 11 ++++++----- chandra/settings.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/chandra/model/vllm.py b/chandra/model/vllm.py index 40f1e7f..2902634 100644 --- a/chandra/model/vllm.py +++ b/chandra/model/vllm.py @@ -72,15 +72,16 @@ def generate_vllm( temperature=temperature, top_p=top_p, ) + result = GenerationResult( + raw=completion.choices[0].message.content, + token_count=completion.usage.completion_tokens, + error=False, + ) except Exception as e: print(f"Error during VLLM generation: {e}") return GenerationResult(raw="", token_count=0, error=True) - return GenerationResult( - raw=completion.choices[0].message.content, - token_count=completion.usage.completion_tokens, - error=False, - ) + return result def process_item(item, max_retries): result = _generate(item) diff --git a/chandra/settings.py b/chandra/settings.py index f204c36..3aa35bb 100644 --- a/chandra/settings.py +++ b/chandra/settings.py @@ -13,7 +13,7 @@ class Settings(BaseSettings): MIN_IMAGE_DIM: int = 1536 MODEL_CHECKPOINT: str = "datalab-to/chandra" TORCH_DEVICE: str | None = None - MAX_OUTPUT_TOKENS: int = 8192 + MAX_OUTPUT_TOKENS: int = 12384 TORCH_ATTN: str | None = None # vLLM server settings