Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to learned round #1107

Merged
merged 4 commits into from
Dec 3, 2024
Merged

Conversation

Giuseppe5
Copy link
Collaborator

Reason for this PR

Fix entrypoint for learned scale
Fix training with float32 + amp

Testing Summary

NA

Risk Highlight

  • This PR includes code from another work (please detail).
  • This PR contains API-breaking changes.
  • This PR depends on work in another PR (please provide links/details).
  • This PR introduces new dependencies (please detail).
  • There are coverage gaps not covered by tests.
  • Documentation updates required in subsequent PR.

Checklist

  • Code comments added to any hard-to-understand areas, if applicable.
  • Changes generate no new warnings.
  • Updated any relevant tests, if applicable.
  • No conflicts with destination dev branch.
  • I reviewed my own code changes.
  • Initial CI/CD passing.
  • 1+ reviews given, and any review issues addressed and approved.
  • Post-review full CI/CD passing.

loss, loss_components = block_loss(quant_outs, fp_outs)
else:
# Run block forward to obtain quant outputs
quant_outs = block_forward(block, inputs)
fp_outs = send_to_device(fp_outs, quant_outs.device)
loss, loss_components = block_loss(quant_outs.to(torch.float32), fp_outs.to(torch.float32))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The code for each condition is almost exactly the same. Maybe we could have autocast(enabled=use_amp, ...) and just have a conditional for upcasting the outputs to float32 before computing the loss to avoid repeting block_forward/send_to_device/block_loss.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I understand it's less code, but I think it will be more confusing. I am leaving as it is. Extra verbosity for clarity, I am happy with that.

Copy link
Collaborator

@pablomlago pablomlago left a comment

Choose a reason for hiding this comment

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

LGTM, I've included a couple of minor comments.

@Giuseppe5 Giuseppe5 merged commit bddfe1e into Xilinx:dev Dec 3, 2024
23 checks passed
@Giuseppe5 Giuseppe5 deleted the fix_llm_entrypoint branch December 3, 2024 23:42
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.

2 participants