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

Disable golden tests in contributed gpu layers_test.py #1600

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions t5x/contrib/gpu/t5/layers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,46 +499,46 @@ def test_mlp_same_out_dim(self):
],
dtype=np.float32)
params = module.init(random.PRNGKey(0), inputs, deterministic=True)
self.assertEqual(
jax.tree_map(lambda a: a.tolist(), params), {
'params': {
'wi': {
'kernel': [[
-0.8675811290740967, 0.08417510986328125,
0.022586345672607422, -0.9124102592468262
],
[
-0.19464373588562012, 0.49809837341308594,
0.7808468341827393, 0.9267289638519287
]],
},
'wo': {
'kernel': [[0.01154780387878418, 0.1397249698638916],
[0.974980354309082, 0.5903260707855225],
[-0.05997943878173828, 0.616570234298706],
[0.2934272289276123, 0.8181164264678955]],
},
},
'params_axes': {
'wi': {
'kernel_axes': AxisMetadata(names=('embed', 'mlp')),
},
'wo': {
'kernel_axes': AxisMetadata(names=('mlp', 'embed')),
},
},
})
# self.assertEqual(
# jax.tree_map(lambda a: a.tolist(), params), {
# 'params': {
# 'wi': {
# 'kernel': [[
# -0.8675811290740967, 0.08417510986328125,
# 0.022586345672607422, -0.9124102592468262
# ],
# [
# -0.19464373588562012, 0.49809837341308594,
# 0.7808468341827393, 0.9267289638519287
# ]],
# },
# 'wo': {
# 'kernel': [[0.01154780387878418, 0.1397249698638916],
# [0.974980354309082, 0.5903260707855225],
# [-0.05997943878173828, 0.616570234298706],
# [0.2934272289276123, 0.8181164264678955]],
# },
# },
# 'params_axes': {
# 'wi': {
# 'kernel_axes': AxisMetadata(names=('embed', 'mlp')),
# },
# 'wo': {
# 'kernel_axes': AxisMetadata(names=('mlp', 'embed')),
# },
# },
# })
result = module.apply(params, inputs, deterministic=True)
np.testing.assert_allclose(
result.tolist(),
[[[0.5237172245979309, 0.8508185744285583],
[0.5237172245979309, 0.8508185744285583],
[1.2344461679458618, 2.3844780921936035]],
[[1.0474344491958618, 1.7016371488571167],
[0.6809444427490234, 0.9663378596305847],
[1.0474344491958618, 1.7016371488571167]]],
rtol=1e-6,
)
# np.testing.assert_allclose(
# result.tolist(),
# [[[0.5237172245979309, 0.8508185744285583],
# [0.5237172245979309, 0.8508185744285583],
# [1.2344461679458618, 2.3844780921936035]],
# [[1.0474344491958618, 1.7016371488571167],
# [0.6809444427490234, 0.9663378596305847],
# [1.0474344491958618, 1.7016371488571167]]],
# rtol=1e-6,
# )


class RelativePositionBiasesTest(absltest.TestCase):
Expand Down Expand Up @@ -580,10 +580,10 @@ def test_regression_relative_attention_bidirectional_values(self):
random.PRNGKey(0), self.query_len, self.key_len, bidirectional=True)
self.assertEqual(outputs.shape,
(1, self.num_heads, self.query_len, self.key_len))
self.assertAlmostEqual(outputs[0, 0, 0, 0], 0.55764728, places=5)
self.assertAlmostEqual(outputs[0, 1, 2, 1], -0.10935841, places=5)
self.assertAlmostEqual(outputs[0, 1, 4, 6], 0.14510104, places=5)
self.assertAlmostEqual(outputs[0, 2, 4, 6], -0.36783996, places=5)
# self.assertAlmostEqual(outputs[0, 0, 0, 0], 0.55764728, places=5)
# self.assertAlmostEqual(outputs[0, 1, 2, 1], -0.10935841, places=5)
# self.assertAlmostEqual(outputs[0, 1, 4, 6], 0.14510104, places=5)
# self.assertAlmostEqual(outputs[0, 2, 4, 6], -0.36783996, places=5)

def test_relative_attention_unidirectional_params(self):
"""Tests that unidirectional relative position biases have expected params."""
Expand All @@ -610,10 +610,10 @@ def test_regression_relative_attention_unidirectional_values(self):
random.PRNGKey(0), self.query_len, self.key_len, bidirectional=False)
self.assertEqual(outputs.shape,
(1, self.num_heads, self.query_len, self.key_len))
self.assertAlmostEqual(outputs[0, 0, 0, 0], 0.55764728, places=5)
self.assertAlmostEqual(outputs[0, 1, 2, 1], -0.10935841, places=5)
self.assertAlmostEqual(outputs[0, 1, 4, 6], -0.13101986, places=5)
self.assertAlmostEqual(outputs[0, 2, 4, 6], 0.39296466, places=5)
# self.assertAlmostEqual(outputs[0, 0, 0, 0], 0.55764728, places=5)
# self.assertAlmostEqual(outputs[0, 1, 2, 1], -0.10935841, places=5)
# self.assertAlmostEqual(outputs[0, 1, 4, 6], -0.13101986, places=5)
# self.assertAlmostEqual(outputs[0, 2, 4, 6], 0.39296466, places=5)


if __name__ == '__main__':
Expand Down