Skip to content

Conversation

@Haseebasif7
Copy link

Clamp temperature to ≥ 1.0 to fix noise in Dia generation

What does this PR do?

This PR clamps the temperature parameter to a minimum value of 1.0 during Dia model generation.

The change aligns the Transformers implementation with the original Dia reference configuration and the Nari Labs demo UI, where the temperature slider does not allow values below 1.0. Allowing temperature < 1.0 was found to produce unstable and noisy audio outputs, and in some cases could lead to generation failures.

By enforcing a lower bound of 1.0, this PR:

  • Prevents noisy or degraded audio generation
  • Matches the behavior of the original Dia implementation and UI
  • Avoids confusing or misleading semantics for users

This is a non-breaking change: values below 1.0 are silently clamped to 1.0.

Fixes #43016

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline, Pull Request section?
  • Was this discussed/approved via a Github issue or the forum?
    Dia model cannot load/ generation error #43016
  • Did you make sure to update the documentation with your changes?
    Not applicable — behavior matches upstream reference implementation.
  • Did you write any new necessary tests?
    Not added — this is a behavioral clamp and existing coverage is sufficient.

Who can review?

This change affects audio models and generation logic.
Tagging the following reviewers:

Library:

Integrations:

Devices/Backends:

Documentation: @stevhliu

Research projects are not maintained and should be taken as is.

-->

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! Does this fix your issue @jiqing-feng ?

Comment on lines 118 to 122
logger.warning_once(
f"temperature < 1.0 is not supported for Dia; clamping to 1.0 "
f"(got {generation_config.temperature})"
)
generation_config.temperature = 1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should just warn and not clamp ? The code runs fine even when temperature < 1

@SunMarc
Copy link
Member

SunMarc commented Dec 24, 2025

@bot /style

@github-actions
Copy link
Contributor

github-actions bot commented Dec 24, 2025

Style bot fixed some files and pushed the changes.

@github-actions
Copy link
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: dia

@jiqing-feng
Copy link
Contributor

Thanks ! Does this fix your issue @jiqing-feng ?

My example still outputs noise.

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.

Dia model cannot load/ generation error

3 participants