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

Investigate low accuracy in albert/albert-base-v2 #760

Open
ayerofieiev-tt opened this issue Feb 12, 2025 · 4 comments
Open

Investigate low accuracy in albert/albert-base-v2 #760

ayerofieiev-tt opened this issue Feb 12, 2025 · 4 comments
Assignees
Labels

Comments

@ayerofieiev-tt
Copy link
Member

No description provided.

@ayerofieiev-tt
Copy link
Member Author

	1. low pcc at ttnn_tanh (0.9945167693107032) (created ticket: https://github.com/tenstorrent/tt-metal/issues/17721)
	2. PCC seems to gradually shrink to 0.694 result of a faulty tanh

@amalbasaTT
Copy link

@ayerofieiev-tt I tested if fixing tanh would approve accuracy in albert-v2-base model (will test for others too). I replaced every ttnn_tanh in forward function like this:

  #ttnn_tanh = ttnn.tanh(ttnn_multiply_4, )
  ttnn_tanh_intermediate = aten.tanh.default(ttnn.to_torch(ttnn_multiply_4), )
  ttnn_tanh = ttnn.from_torch(ttnn_tanh_intermediate, device=device, layout = ttnn.TILE_LAYOUT, dtype = ttnn.bfloat16)

Accuracy went to 0.9435372886378103.
You can test it yourself, checkout amalbasaTT/abase_v2-aten-tanh on pytorch2.0_ttnn and run python tests/autogen_accuracy_tests/albert/albert-base-v2_code.py

@ayerofieiev-tt
Copy link
Member Author

ayerofieiev-tt commented Feb 19, 2025

@amalbasaTT thank you!
Even with tanh fallback - its still pretty low, right? Can you check what further operation causes a divergence?

@amalbasaTT
Copy link

If 0.994 PCC tanh caused that much damage, I suspect that even 0.999 PCC tensors can accumulate over time so in that sense 0.94 is not that low in my opinion. But i will investigate of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants