Skip to content

Allow Infinity and NaN in JSON parsing#13

Merged
DePasqualeOrg merged 1 commit intomainfrom
allow-infinity-nan-json
Mar 4, 2026
Merged

Allow Infinity and NaN in JSON parsing#13
DePasqualeOrg merged 1 commit intomainfrom
allow-infinity-nan-json

Conversation

@DePasqualeOrg
Copy link
Copy Markdown
Owner

Cherry-pick of upstream #324.

Problem

Some model configs (e.g., mlx-community/NVIDIA-Nemotron-3-Nano-30B-A3B-4bit) contain Infinity, -Infinity, or NaN values in their JSON. The YYJSON parser rejected these as invalid, causing config loading to fail.

Fix

Pass YYJSON_READ_ALLOW_INF_AND_NAN flag to yyjson_read_opts. Our fork has two parseToConfig overloads (upstream only has one), so the flag was applied to both.

Skipped the upstream Tests/HubTests test (out of scope for our fork).

Add YYJSON_READ_ALLOW_INF_AND_NAN flag to both YYJSONParser.parseToConfig
overloads. Upstream only had one call site; our fork has a second overload
that also needed the flag.

Cherry-picked from huggingface/swift-transformers#324 (150169b).

Co-Authored-By: Anthony DePasquale <anthony@depasquale.org>
@DePasqualeOrg DePasqualeOrg merged commit 1f4bf36 into main Mar 4, 2026
3 checks passed
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