Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Constrained generation always picks the first `anyOf` variant

クローズ
#289 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@2570165831 がすでに取り組んでいます。

2026年10月6日 から。

  • #309 @2570165831 による — マージされずにクローズ
  • #320 @mattt による — マージ済み

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
swift

調査の方向性

Start in StructuredGeneration.swift at generateNode(_:) and compare its anyOf handling with itemStartTokens(for:), which already masks array-item start tokens. Trace how sampled tokens identify a variant, including nullable unions and variants with the same initial structure; done means constrained generation can select each anyOf branch rather than always using the first.

索引モデルが issue の本文から書いたものです。

説明

Local models that use constrained generation (MLX, Core ML, and llama.cpp) always generate the first variant of an anyOf schema, because generateNode(_:) in StructuredGeneration.swift takes variants[0]. So a nullable union like anyOf: [person, .null] (#288) can never produce null, and a union of object types always produces the first one.

The model should choose the branch. One approach is to mask the next token to the start tokens of every variant, as itemStartTokens(for:) already does for array items, and continue with the variant whose start tokens include the sampled token. Variants that start the same way, like two object types, would need to look ahead to the first key.

主要言語
Swift
スター
948
フォーク
99
平均マージ
19時間 57分
マージ済み PR(30日)
50

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

huggingface/AnyLanguageModel のほかの issue

huggingface/AnyLanguageModel の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。