Port tt-torch models to forge #1337
Draft
GitHub Actions / TT-Forge-FE Tests
failed
Feb 28, 2025 in 0s
620 tests run, 483 passed, 136 skipped, 1 failed.
Annotations
Check failure on line 44 in forge/test/models/pytorch/vision/ghostnet/test_ghostnet.py
github-actions / TT-Forge-FE Tests
test_ghostnet.test_ghostnet_timm[ghostnetv2_100.in1k]
AssertionError: Only support upsample with integer scale factor
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f8a5db94a60>
variant = 'ghostnetv2_100.in1k'
@pytest.mark.push
@pytest.mark.nightly
@pytest.mark.parametrize("variant", params)
def test_ghostnet_timm(record_forge_property, variant):
# Build Module Name
module_name = build_module_name(
framework=Framework.PYTORCH,
model="ghostnet",
variant=variant,
source=Source.TIMM,
task=Task.IMAGE_CLASSIFICATION,
)
# Record Forge Property
record_forge_property("model_name", module_name)
# Load the model and prepare input data
framework_model, inputs = load_ghostnet_model(variant)
# Forge compile framework model
> compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)
forge/test/models/pytorch/vision/ghostnet/test_ghostnet.py:44:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:251: in compile_main
return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:293: in forge_compile_from_context
next_stage = stage_to_func[current_stage](context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:671: in generate_initial_graph
module, module_inputs = convert_to_forge_module(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:1032: in convert_to_forge_module
forge_module, dev_types, module_inputs = generate_forge_module(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tvm_to_python.py:2120: in generate_forge_module
forge_outputs = get_forge_outputs(forge_mods, devices, forge_inputs)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tvm_to_python.py:1957: in get_forge_outputs
forge_inputs = mod.forward(*forge_inputs)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/module.py:633: in wrap_forward
return orig_forward(*args, **kwargs)
generated_modules/pt_ghostnet_ghostnetv2_100_in1k_img_cls_timm_453.py:4448: in forward
resize2d_2654 = forge.op.Resize2d("", sigmoid_2653, sizes=[7, 7], method="nearest_neighbor", align_corners=False, channel_last=0).set_src_layer("timm.models.ghostnet.GhostNet::/torch.nn.modules.container.Sequential::blocks/torch.nn.modules.container.Sequential::8/timm.models.ghostnet.GhostBottleneck::0/timm.models.ghostnet.GhostModuleV2::ghost1")
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/op/resize.py:60: in Resize2d
).get_tensor()
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/op/common.py:54: in get_tensor
shape, self.operand_broadcast = get_f_forge_shape(self.cpp_op_type)(shapes)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/op/eval/forge/__init__.py:219: in <lambda>
return lambda *inputs: module_or_class.shape(op_type.op, op_type.attr, *inputs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
type = 'resize2d', attr = [7, 7, 0, 0, 0], ops = [(1, 960, 3, 3)]
def shape(type, attr, ops):
if type == "resize2d":
assert len(attr) == 5, "Resize2d should have 4 attrs: [size, size, method, align_corners]"
shape = list(ops[0])
channel_last = attr[-1]
upsample = attr[0] >= shape[-3] if channel_last else attr[0] >= shape[-2]
if channel_last:
if upsample:
assert attr[1] >= shape[-2], "One dim upsamples, the other dim should also upsample"
assert (
attr[0] % shape[-3] == 0 and attr[1] % shape[-2] == 0
), "Only support upsample with integer scale factor"
else:
assert attr[1] < shape[-2], "One dim downsamples, the other dim should also downsample"
assert (
shape[-3] % attr[0] == 0 and shape[-2] % attr[1] == 0
), "Only support downsample with integer scale factor"
assert shape[-3] // attr[0] == shape[-2] // attr[1], "Only support same scale factor for H and W"
shape[-3], shape[-2] = attr[0], attr[1]
return shape, []
else:
if upsample:
assert attr[1] >= shape[-1], "One dim upsamples, the other dim should also upsample"
assert (
> attr[0] % shape[-2] == 0 and attr[1] % shape[-1] == 0
), "Only support upsample with integer scale factor"
E AssertionError: Only support upsample with integer scale factor
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/op/eval/forge/resize.py:115: AssertionError
Loading