Skip to content

fix: bump swift-transformers minimum to 1.2.0 (trailing comma fix)#378

Merged
Alex-Wengg merged 2 commits intoFluidInference:mainfrom
amitach:fix/bump-swift-transformers-trailing-commas
Mar 15, 2026
Merged

fix: bump swift-transformers minimum to 1.2.0 (trailing comma fix)#378
Alex-Wengg merged 2 commits intoFluidInference:mainfrom
amitach:fix/bump-swift-transformers-trailing-commas

Conversation

@amitach
Copy link
Copy Markdown
Contributor

@amitach amitach commented Mar 15, 2026

Summary

Bumps the minimum swift-transformers dependency from 1.1.6 to 1.2.0 to fix JSON parsing failures caused by trailing commas in HuggingFace model config files.

Problem

swift-transformers 1.1.7–1.1.9 replaced Foundation's JSONSerialization with yyjson for performance in HubApi.configuration(fileURL:). The yyjson read flags included YYJSON_READ_ALLOW_INF_AND_NAN but not YYJSON_READ_ALLOW_TRAILING_COMMAS, causing strict rejection of trailing commas that JSONSerialization previously accepted silently.

This causes CtcTokenizer.load(from:) to fail when the model directory contains a config.json with trailing commas:

yyjson read failed (code 4) at position 237: trailing comma is not allowed

Fix

swift-transformers 1.2.0 (released March 9, 2026) adds YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_BOM to the yyjson flags. This PR bumps FluidAudio's minimum to 1.2.0 so all consumers get the fix.

Change

- .package(url: "https://github.com/huggingface/swift-transformers", from: "1.1.6")
+ .package(url: "https://github.com/huggingface/swift-transformers", from: "1.2.0")

Fixes #377


Open with Devin

devin-ai-integration[bot]

This comment was marked as resolved.

swift-transformers 1.1.7–1.1.9 replaced Foundation's JSONSerialization
with yyjson for performance but did not enable
YYJSON_READ_ALLOW_TRAILING_COMMAS, causing CtcTokenizer.load() to fail
on HuggingFace config.json files with trailing commas.

Fixed upstream in swift-transformers 1.2.0.

Fixes FluidInference#377
@amitach amitach force-pushed the fix/bump-swift-transformers-trailing-commas branch from f582296 to c609696 Compare March 15, 2026 10:50
@amitach
Copy link
Copy Markdown
Contributor Author

amitach commented Mar 15, 2026

Fixed Devin's review comment — ran swift package resolve and committed the updated Package.resolved (now pins swift-transformers to 1.2.0).

@Alex-Wengg Alex-Wengg merged commit 8c2c3bd into FluidInference:main Mar 15, 2026
12 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.

CtcTokenizer.load() fails on HuggingFace config.json with trailing commas (swift-transformers 1.1.7–1.1.9)

2 participants