Skip to content

fix(dashboard-api): use _positive_number for regex param matches in model_memory.py - #2620

Open
mohitchauhan221 wants to merge 1 commit into
Osmantic:mainfrom
mohitchauhan221:fix/dashboard-api-model-memory-regex-positive
Open

fix(dashboard-api): use _positive_number for regex param matches in model_memory.py#2620
mohitchauhan221 wants to merge 1 commit into
Osmantic:mainfrom
mohitchauhan221:fix/dashboard-api-model-memory-regex-positive

Conversation

@mohitchauhan221

Copy link
Copy Markdown

Problem

In ods/extensions/services/dashboard-api/model_memory.py, estimated_param_billions() extracts model parameter scales from model names and filenames using re.findall(r"(\d+(?:\.\d+)?)\s*b", ...). Directly mapping matches with float(match) could raise a ValueError on malformed match groups.

Fix

Use the existing _positive_number() helper function to validate regex parameter scale matches safely before adding them to candidate scale numbers.

Verification

Verified syntax with python3 -m py_compile ods/extensions/services/dashboard-api/model_memory.py. git diff --check passed cleanly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants