Skip to content

[Core] Refactor quantization parsing into base model config#557

Open
YouNeedCryDear wants to merge 3 commits intomainfrom
fix/quant-parsing
Open

[Core] Refactor quantization parsing into base model config#557
YouNeedCryDear wants to merge 3 commits intomainfrom
fix/quant-parsing

Conversation

@YouNeedCryDear
Copy link
Copy Markdown
Collaborator

@YouNeedCryDear YouNeedCryDear commented Apr 1, 2026

What this PR does

  • moves quantization parsing into BaseModelConfig
  • removes duplicated quant parsing from individual model config implementations
  • updates phi to rely on the shared base model config behavior

Why we need it

The HuggingFaceModel interface requires every model configuration object to implement the GetQuantizationType() string method. Currently, over 30 distinct architectural implementations (e.g., QwenConfig, LlamaConfig, DeepseekV3Config) successfully satisfy this requirement.

However, almost none of these implementations utilize a centralized method. As a result, 90% of the model implementation files contain identical copy-pasted blocks redefining the JSON configuration struct and the accessor method:

This consolidates quantization parsing in one place so model config implementations stay consistent and easier to maintain. It also removes duplicated parsing paths that had drifted across individual model types.

Fixes #

How to test

  • Run go test ./pkg/hfutil/modelconfig
  • Optionally run go test ./pkg/hfutil/... in an environment that allows httptest to bind local ports for pkg/hfutil/hub tests

Checklist

  • Tests added/updated (if applicable)
  • Docs updated (if applicable)
  • make test passes locally

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions Bot added the models Model configuration changes label Apr 1, 2026
@YouNeedCryDear YouNeedCryDear changed the title Refactor quantization parsing into base model config (core) Refactor quantization parsing into base model config Apr 1, 2026
@YouNeedCryDear YouNeedCryDear changed the title (core) Refactor quantization parsing into base model config [Core] Refactor quantization parsing into base model config Apr 1, 2026
@heymrbox heymrbox self-requested a review April 3, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models Model configuration changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants