Skip to content

Commit

Permalink
Revert "add comparison of pcc/atol of all outputs"
Browse files Browse the repository at this point in the history
This reverts commit 8bb73bc.
  • Loading branch information
AleksKnezevic committed Jan 13, 2025
1 parent 486be3b commit 1ac52b5
Show file tree
Hide file tree
Showing 9 changed files with 573 additions and 198 deletions.
2 changes: 1 addition & 1 deletion tests/models/MobileNetV2/test_MobileNetV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_MobileNetV2(record_property, mode, nightly):
else:
cc.compile_depth = CompileDepth.TTNN_IR

tester = ThisTester(model_name, mode, compiler_config=cc, required_atol=0.03)
tester = ThisTester(model_name, mode, compiler_config=cc)
results = tester.test_model()
if mode == "eval":
# Print the top 5 predictions
Expand Down
4 changes: 1 addition & 3 deletions tests/models/autoencoder_linear/test_autoencoder_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ def test_autoencoder_linear(record_property, mode, nightly):
if nightly:
cc.compile_depth = CompileDepth.EXECUTE_OP_BY_OP

tester = ThisTester(
model_name, mode, pcc=0.1, required_atol=0.2, compiler_config=cc
)
tester = ThisTester(model_name, mode, compiler_config=cc)
results = tester.test_model()

if mode == "eval":
Expand Down
11 changes: 2 additions & 9 deletions tests/models/beit/test_beit_image_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ def append_fake_loss_function(self, outputs):
def get_results_train(self, model, inputs, outputs):
return inputs["pixel_values"].grad

def _extract_outputs(self, output_object):
return (output_object.logits,)


@pytest.mark.parametrize(
"mode",
Expand All @@ -60,18 +57,14 @@ def test_beit_image_classification(record_property, model_name, mode, nightly):
else:
cc.compile_depth = CompileDepth.TTNN_IR

atol = 0.05
tester = ThisTester(model_name, mode, compiler_config=cc, required_atol=atol)
tester = ThisTester(model_name, mode, compiler_config=cc)
results = tester.test_model()

if mode == "eval":
logits = results.logits

# model predicts one of the 1000 ImageNet classes
predicted_class_idx = logits.argmax(-1).item()
print(
"Predicted class:",
tester.framework_model.config.id2label[predicted_class_idx],
)
print("Predicted class:", tester.model.config.id2label[predicted_class_idx])

record_property("torch_ttnn", (tester, results))
5 changes: 1 addition & 4 deletions tests/models/mgp-str-base/test_mgp_str_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ def _load_inputs(self):
inputs["pixel_values"] = inputs["pixel_values"].to(torch.bfloat16)
return inputs

def _extract_outputs(self, output_object):
return output_object.logits


@pytest.mark.parametrize(
"mode",
Expand All @@ -55,7 +52,7 @@ def test_mgp_str_base(record_property, mode, nightly):
else:
cc.compile_depth = CompileDepth.TTNN_IR

tester = ThisTester(model_name, mode, relative_atol=0.02, compiler_config=cc)
tester = ThisTester(model_name, mode, compiler_config=cc)
results = tester.test_model()

if mode == "eval":
Expand Down
6 changes: 2 additions & 4 deletions tests/models/openpose/test_openpose_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,17 @@ def get_image_tensor():
return input_batch


# NOTE: If we are to decompose BatchNorm2d (which we must in order to lower to SHLO)
# we need to run in float32 to maintain precision.
class ThisTester(ModelTester):
def _load_model(self):
# Create PyBuda module from PyTorch model
model = ptcv_get_model("lwopenpose2d_mobilenet_cmupan_coco", pretrained=True)
model = model.to(torch.float32)
model = model.to(torch.bfloat16)
return model

def _load_inputs(self):
input_batch = [get_image_tensor()]
batch_input = torch.cat(input_batch, dim=0)
batch_input = batch_input.to(torch.float32)
batch_input = batch_input.to(torch.bfloat16)
return batch_input


Expand Down
5 changes: 1 addition & 4 deletions tests/models/perceiver_io/test_perceiver_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ def _load_inputs(self):
}
return arguments

def _extract_outputs(self, output_object):
return (output_object.logits,)


@pytest.mark.parametrize(
"mode",
Expand All @@ -55,7 +52,7 @@ def test_perceiver_io(record_property, mode, nightly):
else:
cc.compile_depth = CompileDepth.TTNN_IR

tester = ThisTester(model_name, mode, relative_atol=0.02, compiler_config=cc)
tester = ThisTester(model_name, mode, compiler_config=cc)
results = tester.test_model()
if mode == "eval":
logits = results.logits
Expand Down
3 changes: 0 additions & 3 deletions tests/models/squeeze_bert/test_squeeze_bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ def _load_inputs(self):
inputs = self.tokenizer("Hello, my dog is cute", return_tensors="pt")
return inputs

def _extract_outputs(self, output_object):
return (output_object.logits,)


@pytest.mark.parametrize(
"mode",
Expand Down
Loading

0 comments on commit 1ac52b5

Please sign in to comment.