Skip to content

Fix scheduler stepping and label dtype handling in training loop#173

Open
likitha487 wants to merge 1 commit intoML4SCI:mainfrom
likitha487:fix-issue-152
Open

Fix scheduler stepping and label dtype handling in training loop#173
likitha487 wants to merge 1 commit intoML4SCI:mainfrom
likitha487:fix-issue-152

Conversation

@likitha487
Copy link

Fixes issue #152

Changes made:

  1. Replaced scheduler.step(loss) with scheduler.step() since some schedulers like CosineAnnealingWarmRestarts do not require the loss value.
  2. Updated label conversion from labels.type(torch.LongTensor).to(device) to labels.long().to(device) to avoid unnecessary CPU tensor creation.

This improves training stability and prevents unnecessary tensor transfers.

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