Skip to content

Conversation

@Astro36
Copy link

@Astro36 Astro36 commented Nov 26, 2025

Description

The self.scaling parameter is created using torch.empty and is then used without being initialized.
This is not a problem during finetuning, because pretrained checkpoints provide valid scaling parameters.
But when training from scratch, these undefined values may occasionally cause numerical instability and lead to NaN outputs.
Initializing self.scaling with torch.randn ensures proper initial values and improves training stability.

List of changes

  • Initialize self.scaling with torch.randn.

For reviewers

  • No functionality change, just fixed parameter initialization.

Initialize scaling parameter with random values.
@google-cla
Copy link

google-cla bot commented Nov 26, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant