Open andydelworth opened 1 month ago
hmm looking at the history of the code, I think the expectation was that if use_logits=False
, self.labels
would not be set, because the metric is going to be taken directly from the output class of the HF model (e.g. cross entropy loss, rather than recomputing externally to the hf model). That being said, I don't think we have any code that does this anymore, and happy to accept a PR setting self.labels
in the else branch.
Environment
** To reproduce
Steps to reproduce the behavior:
Since I am working out of an internal repo, it's not straightforward for me to provide this - please do lmk if you think it will be helpful.
Expected behavior
https://github.com/mosaicml/composer/blob/main/composer/models/huggingface.py#L129
This line mentions that self.labels should be set in eval_forward(), if it exists. However, we see that self.labels is set in the if and elif branches of the eval_forward() method, but not in the else branch shown here:
https://github.com/mosaicml/composer/blob/main/composer/models/huggingface.py#L567
This causes down stream metrics to throw errors, since self.labels remains as None.
Additional context
Please let me know if I should open a PR to fix, or if there is something that I am not understanding correctly here - thank you all!