Diffusers documentation

EntropyBoundScheduler

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

EntropyBoundScheduler

EntropyBoundScheduler は、結合エントロピーが entropy_bound 以下に収まる最もエントロピーの低い位置をコミットします。これにより、おおよそ独立したトークンがまとめて受け入れられ、残りは再ノイズ化されます。サンプリング温度は、最初のステップで t_max から始まり、最後のステップで t_min までアニーリングされ、公開されたチェックポイントのサンプラーと一致します。Accelerated Sampling from Masked Diffusion Models via Entropy Bounded Unmasking で提案されました。

このスケジューラは、DiffusionGemmaPipelineで使用されます。

EntropyBoundScheduler

class diffusers.EntropyBoundScheduler

< >

( entropy_bound: float = 0.1t_max: float = 0.8t_min: float = 0.4num_inference_steps: int = 32 )

パラメータ

  • entropy_bound (float、デフォルト値 0.1) — 受け入れられたトークンの許容される最大結合エントロピーです。値を大きくすると、1ステップあたりに受け入れられるトークン数が増えます。
  • t_max (float、デフォルト値は 0.8) — 最初のデノイジングステップにおけるサンプリング温度。
  • t_min (float、デフォルト値は 0.4) — 最後のデノイジングステップにおけるサンプリング温度。
  • num_inference_steps (int、デフォルト値は 32) — デノイジングステップの最大数です。

一様破損プロセス用のエントロピー境界スケジューラ。

各ステップで、スケジューラーは各ポジションに対して候補トークンをサンプリングし、sum_i^k entropy_i - max(entropy_1, ..., entropy_k) <= entropy_bound を満たすように、エントロピーが最も低い k 個のポジションを受け入れます。左辺は、受け入れられたトークン間の結合相互情報量の上限を与えるため、それらは近似的に独立となります。受け入れられたポジションはサンプリングされたトークンを保持し、それ以外のポジションは、一様ランダムなトークンで再ノイズ化されます(マスクトークンは存在しません)。

「Accelerated Sampling from Masked Diffusion Models via Entropy Bounded Unmasking」(https://huggingface.co/papers/2505.24857)で提案されました。

サンプリング温度は、最初のステップでt_maxから始まり、最後のステップでt_minまでアニーリングされます。これにより、公開されているチェックポイントのサンプラー(デノイジングが進むにつれてサンプリングがシャープになる)と一致します。この温度は、候補のサンプリングと、受け入れを決定するエントロピーの両方に、logitsに対して適用されます。

ステップ

< >

( model_output: torch.Tensortimestep: int | torch.Tensorsample: torch.LongTensorentropy_bound: float | None = Nonegenerator: torch.Generator | None = Nonereturn_dict: bool = True )

パラメータ

  • model_output (torch.Tensor、形状 (batch_size, block_length, vocab_size)) — 現在のブロックに対するモデルからの生の logits。
  • timestep (int または torch.Tensor) — デノイジングスケジュール内の現在のステップインデックス。アニーリングされたサンプリング温度を設定します。
  • sample (torch.LongTensor、形状 (batch_size, block_length)) — 現在のブロックのトークン ID。
  • entropy_bound (float, 省略可) — このステップで設定されたエントロピーの上限をオーバーライドします。
  • generator (torch.Generator、任意) — サンプリング用の乱数生成器。
  • return_dict (bool) — EntropyBoundSchedulerOutput を返すか、通常のタプルを返すかを指定します。

エントロピーの上限以下にある最低エントロピーの位置を受け入れ、残りの位置には再ノイズを適用します。

EntropyBoundSchedulerOutput

class diffusers.EntropyBoundSchedulerOutput

< >

( prev_sample: torch.LongTensoraccepted_index: torch.BoolTensorsampled_tokens: torch.LongTensorsampled_probs: torch.Tensorpred_logits: torch.Tensor )

パラメータ

  • prev_sample (torch.LongTensor、形状 (batch_size, block_length)) — 現在のデノイジングステップ後に更新されたブロックトークン。
  • accepted_index (torch.BoolTensor、shape (batch_size, block_length)) — このステップで受け入れられた(コミットされた)位置のブールマスク。
  • sampled_tokens (torch.LongTensor、形状 (batch_size, block_length)) — モデルの logits からサンプリングされたトークン ID です。
  • sampled_probs (torch.Tensor、形状 (batch_size, block_length)) — サンプリングされたトークンの確率です。
  • pred_logits (torch.Tensor、形状 (batch_size, block_length, vocab_size)) — 次のステップの自己条件付けのために、候補がサンプリングされた温度スケーリング済み logits です。

エントロピー境界スケジューラー用の出力クラス。

Update on GitHub