Skip to content

Bump tolerances for per_sample_grads tutorial #3487

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

Merged
merged 14 commits into from
Jul 30, 2025
Merged
11 changes: 7 additions & 4 deletions .jenkins/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ sudo apt-get install -y pandoc
#Install PyTorch Nightly for test.
# Nightly - pip install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
# Install 2.5 to merge all 2.4 PRs - uncomment to install nightly binaries (update the version as needed).
# sudo pip uninstall -y fbgemm-gpu torchrec
# sudo pip uninstall -y torch torchvision torchaudio torchtext torchdata torchrl tensordict
# sudo pip3 install fbgemm-gpu==1.1.0 torchrec==1.0.0 --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu124
# pip3 install torch==2.7.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu126
#sudo pip uninstall -y fbgemm-gpu torchrec
sudo pip uninstall -y torch torchvision torchaudio torchtext torchdata torchrl tensordict
pip3 install torch==2.8.0 torchvision torchaudio --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu126
pip3 install torchrl==0.9.1 tensordict==0.9.1
# sudo pip3 install fbgemm-gpu==1.2.0 torchrec==1.2.0 --no-cache-dir --index-url https://download.pytorch.org/whl/test/cu126


# Install two language tokenizers for Translation with TorchText tutorial
python -m spacy download en_core_web_sm
python -m spacy download de_core_news_sm
Expand Down
2 changes: 1 addition & 1 deletion intermediate_source/per_sample_grads.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def compute_loss(params, buffers, sample, target):
# results of hand processing each one individually:

for per_sample_grad, ft_per_sample_grad in zip(per_sample_grads, ft_per_sample_grads.values()):
assert torch.allclose(per_sample_grad, ft_per_sample_grad, atol=3e-3, rtol=1e-5)
assert torch.allclose(per_sample_grad, ft_per_sample_grad, atol=1.2e-1, rtol=1e-5)

######################################################################
# A quick note: there are limitations around what types of functions can be
Expand Down
Loading