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

Fix incorrect reference to model in Transformer class #2078

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MeysamMoghaddam
Copy link

@MeysamMoghaddam MeysamMoghaddam commented Apr 1, 2025

Description:
In the train_step and test_step methods of the Transformer class, there's a reference to model.compute_loss() which should be self.compute_loss() instead. Since we're inside the class methods, we should use self to refer to the current instance of the model.

Files Changed:

transformer_asr.py

Changes Made:

Replaced model.compute_loss() with self.compute_loss() in both train_step and test_step methods

Impact:
This correction ensures proper access to the parent class's compute_loss method through the correct instance reference. The original code would raise a NameError since model is not defined in this context, while self properly refers to the current Transformer instance.

fix: correct model reference to self in Transformer class

Changed model.compute_loss() to self.compute_loss() in train_step 
and test_step methods to properly reference the class instance.
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