facebookresearch / facebookresearch/fairseq2

Should `Wav2Vec2Loss` obey tensor contracts?

Open
#271 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
1.1k
Forks
144
Avg merge
4d 1h
Merged PRs (30d)
1

Description

Wrappers like huggingface accelerate and lightning fabric wrap `loss.backward` to support DDP and other distributed training, where they do things like gradient accumulation (e.g. https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1956) and changes to float precision that expect the loss to be a tensor, not a dataclass. I think the underlying issue is that we usually expect loss to be a tensor and obey those contracts. I wonder if it would be better as a tensordict (https://github.com/pytorch/tensordict) or similar?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.