Skip to content

[api] add API for exporting model as c++ source (#1341) #548

[api] add API for exporting model as c++ source (#1341)

[api] add API for exporting model as c++ source (#1341) #548

GitHub Actions / TT-Forge-FE Tests failed Mar 1, 2025 in 0s

84 tests run, 5 passed, 68 skipped, 11 failed.

Annotations

Check failure on line 86 in forge/test/models/pytorch/text/falcon/test_falcon.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_falcon.test_falcon_3[tiiuae/Falcon3-3B-Base]

RuntimeError: TT_THROW @ /__w/tt-forge-fe/tt-forge-fe/third_party/tt-mlir/third_party/tt-metal/src/tt-metal/tt_metal/impl/allocator/bank_manager.cpp:132: tt::exception
info:
Out of Memory: Not enough space to allocate 1610612736 B DRAM buffer across 12 banks, where each bank needs to store 134217728 B
backtrace:
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libtt_metal.so(+0x15a7e5) [0x7f04fcb5f7e5]
 --- tt::tt_metal::BankManager::allocate_buffer(unsigned long, unsigned long, bool, CoreRangeSet const&, std::optional<unsigned int>)
 --- tt::tt_metal::Allocator::allocate_buffer(tt::tt_metal::v0::Buffer*)
 --- tt::tt_metal::v0::Buffer::allocate_impl()
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libtt_metal.so(+0x125e9f) [0x7f04fcb2ae9f]
 --- tt::tt_metal::v0::Buffer::create(tt::tt_metal::v0::IDevice*, unsigned long, unsigned long, tt::tt_metal::BufferType, tt::tt_metal::TensorMemoryLayout, std::optional<tt::tt_metal::ShardSpecBuffer> const&, std::optional<bool>, std::optional<tt::tt_metal::SubDeviceId>)
 --- tt::tt_metal::tensor_impl::allocate_buffer_on_device(tt::tt_metal::v0::IDevice*, tt::tt_metal::TensorSpec const&)
 --- std::shared_ptr<tt::tt_metal::v0::Buffer> tt::tt_metal::tensor_impl::initialize_data_on_device<float, tt::tt_metal::borrowed_buffer::Buffer>(tt::tt_metal::borrowed_buffer::Buffer<float>&, tt::tt_metal::v0::IDevice*, tt::tt_metal::TensorSpec const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/_ttnn.so(+0x1ebaa7e) [0x7f04fb318a7e]
 --- tt::tt_metal::Tensor tt::tt_metal::tensor_impl::to_device<float>(tt::tt_metal::Tensor const&, tt::tt_metal::v0::IDevice*, tt::tt_metal::MemoryConfig const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/_ttnn.so(_ZN2tt8tt_metal11tensor_impl8dispatchIZNS1_17to_device_wrapperIJRNS0_6TensorERPNS0_2v07IDeviceERKNS0_12MemoryConfigERNS_3stl10StrongTypeIhN4ttnn10QueueIdTagEEEEEEDaDpOT_EUlTyDpOT0_E_JS5_S9_SC_SI_EEEDaNS0_8DataTypeEOT_SO_+0x6d) [0x7f04fb31f25d]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/_ttnn.so(+0x1ec0f51) [0x7f04fb31ef51]
 --- tt::tt_metal::tensor_ops::tensor_to_device(tt::tt_metal::Tensor const&, tt::tt_metal::v0::IDevice*, tt::tt_metal::MemoryConfig const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
 --- tt::tt_metal::Tensor::to_device(tt::tt_metal::v0::IDevice*, tt::tt_metal::MemoryConfig const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>) const
 --- ttnn::operations::core::to_device(tt::tt_metal::Tensor const&, tt::tt_metal::v0::IDevice*, std::optional<tt::tt_metal::MemoryConfig> const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libTTMLIRRuntime.so(+0x16f7a3) [0x7f04fd7ce7a3]
 --- tt::runtime::ttnn::LayoutConverter::handleHostInputLayoutNoTypecast(tt::tt_metal::Tensor const&, std::optional<std::variant<std::reference_wrapper<tt::tt_metal::v0::IDevice>, std::reference_wrapper<tt::tt_metal::distributed::MeshDevice> > >)
 --- tt::runtime::ttnn::LayoutConverter::convertHostTensorLayout(tt::tt_metal::Tensor const&, std::optional<std::variant<std::reference_wrapper<tt::tt_metal::v0::IDevice>, std::reference_wrapper<tt::tt_metal::distributed::MeshDevice> > >)
 --- tt::runtime::ttnn::LayoutConverter::convertTensorLayout(tt::tt_metal::Tensor const&, std::optional<std::variant<std::reference_wrapper<tt::tt_metal::v0::IDevice>, std::reference_wrapper<tt::tt_metal::distributed::MeshDevice> > >)
 --- tt::runtime::ttnn::toLayout(tt::runtime::Tensor, tt::runtime::Device, tt::runtime::Layout)
 --- tt::runtime::ttnn::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
 --- tt::runtime::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
 --- tt::run_binary(tt::runtime::Binary&, int, std::vector<at::Tensor, std::allocator<at::Tensor> > const&)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x318900) [0x7f0507a25900]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x31884e) [0x7f0507a2584e]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xe1e05) [0x7f05077eee05]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x18ab32) [0x555c8a024b32]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x59c7) [0x555c8a014a97]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0xc4) [0x555c8a01a574]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0x122) [0x555c8a033172]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x8af) [0x555c8a00f97f]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f03fd82e230>
variant = 'tiiuae/Falcon3-3B-Base'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants)
    def test_falcon_3(record_forge_property, variant):
    
        if variant == "tiiuae/Falcon3-Mamba-7B-Base" or variant == "tiiuae/Falcon3-7B-Base":
            pytest.skip("Insufficient host DRAM to run this model (requires a bit more than 36 GB)")
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="falcon3", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        tokenizer = AutoTokenizer.from_pretrained(variant)
        model = AutoModelForCausalLM.from_pretrained(variant)
        model.config.use_cache = False
        model.config.return_dict = False
    
        input_text = "Write a function to calculate the factorial of a number"
        input_data = tokenizer.encode(input_text, return_tensors="pt")
    
        # Forge compile framework model
        compiled_model = forge.compile(model, sample_inputs=input_data, module_name=module_name)
    
        # Model Verification
>       verify([input_data], model, compiled_model)

forge/test/models/pytorch/text/falcon/test_falcon.py:86: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/verify.py:302: in verify
    co_out = compiled_model(*inputs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <forge.compiled_graph_state.CompiledModel object at 0x7f03fd823670>
inputs = (tensor([[  7643,   2265,   2991,   2302,  17710,   2278, 122466,   2306,   2265,   3354]]),)
inputs_and_parameters = [tensor([[  7643,   2265,   2991,   2302,  17710,   2278, 122466,   2306,   2265,   3354]], dtype=torch.int32), tensor...0., 0.,  ..., 0., 0., 0.],
          [0., 0., 0.,  ..., 0., 0., 0.],
          [0., 0., 0.,  ..., 0., 0., 0.]]]]), ...]

    def __call__(self, *inputs: AnyTensor) -> List[torch.Tensor]:
        """
        Run inference on the compiled model.
    
        Parameters
        ----------
        inputs: [Tensor, ...]
            Input tensors
    
        Returns
        -------
        List[Tensor]
            Output tensors
        """
        self.inputs = [*to_pt_tensors(inputs)]
        # After tensors are transformed to pt tensors, we have to cast them to dtypes that are actually supported by our hardware.
        self.inputs = [cast_unsupported_torch_dtype(input_tensor) for input_tensor in self.inputs]
    
        inputs_and_parameters = [
            *self.inputs,
            *self.fwd_compiled_graph_state.get_ordered_constant_tensors(),
            *self.fwd_compiled_graph_state.get_ordered_parameter_tensors(),
        ]
    
        assert all(
            [isinstance(t, torch.Tensor) for t in inputs_and_parameters]
        ), "All inputs should be torch tensors by now."
    
        if self.training() and isinstance(self.framework_module, PyTorchModule):
            for name, param in self.framework_module.module.named_parameters():
                if param.requires_grad:
                    our_tensor = self.fwd_compiled_graph_state.get_parameter_tensor(name)
    
                    # NOTE: for parameters that require gradients, we want to share the same tensor with the PyTorch
                    # module. This is because we want to be able to optimize the parameters both on the device
                    # (through our runtime) and via the torch optimizers. So this ensures that whichever side updates
                    # the parameter value, the other side can see the change.
                    #
                    # This could change in the future, but for now ensure that our premise is correct.
                    assert param is our_tensor
    
        logger.info(
            f"Running model {self.framework_module.get_name()} {self.fwd_compiled_graph_state.graph.get_name()} on device..."
        )
>       all_outputs = run_binary(self.compiled_binary, int(ProgramId.FORWARD), inputs_and_parameters)
E       RuntimeError: TT_THROW @ /__w/tt-forge-fe/tt-forge-fe/third_party/tt-mlir/third_party/tt-metal/src/tt-metal/tt_metal/impl/allocator/bank_manager.cpp:132: tt::exception
E       info:
E       Out of Memory: Not enough space to allocate 1610612736 B DRAM buffer across 12 banks, where each bank needs to store 134217728 B
E       backtrace:
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libtt_metal.so(+0x15a7e5) [0x7f04fcb5f7e5]
E        --- tt::tt_metal::BankManager::allocate_buffer(unsigned long, unsigned long, bool, CoreRangeSet const&, std::optional<unsigned int>)
E        --- tt::tt_metal::Allocator::allocate_buffer(tt::tt_metal::v0::Buffer*)
E        --- tt::tt_metal::v0::Buffer::allocate_impl()
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libtt_metal.so(+0x125e9f) [0x7f04fcb2ae9f]
E        --- tt::tt_metal::v0::Buffer::create(tt::tt_metal::v0::IDevice*, unsigned long, unsigned long, tt::tt_metal::BufferType, tt::tt_metal::TensorMemoryLayout, std::optional<tt::tt_metal::ShardSpecBuffer> const&, std::optional<bool>, std::optional<tt::tt_metal::SubDeviceId>)
E        --- tt::tt_metal::tensor_impl::allocate_buffer_on_device(tt::tt_metal::v0::IDevice*, tt::tt_metal::TensorSpec const&)
E        --- std::shared_ptr<tt::tt_metal::v0::Buffer> tt::tt_metal::tensor_impl::initialize_data_on_device<float, tt::tt_metal::borrowed_buffer::Buffer>(tt::tt_metal::borrowed_buffer::Buffer<float>&, tt::tt_metal::v0::IDevice*, tt::tt_metal::TensorSpec const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/_ttnn.so(+0x1ebaa7e) [0x7f04fb318a7e]
E        --- tt::tt_metal::Tensor tt::tt_metal::tensor_impl::to_device<float>(tt::tt_metal::Tensor const&, tt::tt_metal::v0::IDevice*, tt::tt_metal::MemoryConfig const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/_ttnn.so(_ZN2tt8tt_metal11tensor_impl8dispatchIZNS1_17to_device_wrapperIJRNS0_6TensorERPNS0_2v07IDeviceERKNS0_12MemoryConfigERNS_3stl10StrongTypeIhN4ttnn10QueueIdTagEEEEEEDaDpOT_EUlTyDpOT0_E_JS5_S9_SC_SI_EEEDaNS0_8DataTypeEOT_SO_+0x6d) [0x7f04fb31f25d]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/_ttnn.so(+0x1ec0f51) [0x7f04fb31ef51]
E        --- tt::tt_metal::tensor_ops::tensor_to_device(tt::tt_metal::Tensor const&, tt::tt_metal::v0::IDevice*, tt::tt_metal::MemoryConfig const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
E        --- tt::tt_metal::Tensor::to_device(tt::tt_metal::v0::IDevice*, tt::tt_metal::MemoryConfig const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>) const
E        --- ttnn::operations::core::to_device(tt::tt_metal::Tensor const&, tt::tt_metal::v0::IDevice*, std::optional<tt::tt_metal::MemoryConfig> const&, tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libTTMLIRRuntime.so(+0x16f7a3) [0x7f04fd7ce7a3]
E        --- tt::runtime::ttnn::LayoutConverter::handleHostInputLayoutNoTypecast(tt::tt_metal::Tensor const&, std::optional<std::variant<std::reference_wrapper<tt::tt_metal::v0::IDevice>, std::reference_wrapper<tt::tt_metal::distributed::MeshDevice> > >)
E        --- tt::runtime::ttnn::LayoutConverter::convertHostTensorLayout(tt::tt_metal::Tensor const&, std::optional<std::variant<std::reference_wrapper<tt::tt_metal::v0::IDevice>, std::reference_wrapper<tt::tt_metal::distributed::MeshDevice> > >)
E        --- tt::runtime::ttnn::LayoutConverter::convertTensorLayout(tt::tt_metal::Tensor const&, std::optional<std::variant<std::reference_wrapper<tt::tt_metal::v0::IDevice>, std::reference_wrapper<tt::tt_metal::distributed::MeshDevice> > >)
E        --- tt::runtime::ttnn::toLayout(tt::runtime::Tensor, tt::runtime::Device, tt::runtime::Layout)
E        --- tt::runtime::ttnn::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
E        --- tt::runtime::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
E        --- tt::run_binary(tt::runtime::Binary&, int, std::vector<at::Tensor, std::allocator<at::Tensor> > const&)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x318900) [0x7f0507a25900]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x31884e) [0x7f0507a2584e]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xe1e05) [0x7f05077eee05]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x18ab32) [0x555c8a024b32]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x59c7) [0x555c8a014a97]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0xc4) [0x555c8a01a574]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0x122) [0x555c8a033172]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x8af) [0x555c8a00f97f]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compiled_graph_state.py:266: RuntimeError

Check failure on line 54 in forge/test/models/pytorch/text/qwen/test_qwen.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_qwen.test_qwen1_5_causal_lm[Qwen/Qwen1.5-0.5B]

RuntimeError: Input count mismatch: expected 533, got 534
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f05fbeb9f30>
variant = 'Qwen/Qwen1.5-0.5B'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", ["Qwen/Qwen1.5-0.5B"])
    def test_qwen1_5_causal_lm(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="qwen1.5", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        # Setup model configuration
        config = Qwen2Config.from_pretrained(variant)
        config.use_cache = False
        config.return_dict = False
    
        # Load model and tokenizer with config
        framework_model = Qwen2ForCausalLM.from_pretrained(variant, config=config)
        tokenizer = Qwen2Tokenizer.from_pretrained(variant)
        tokenizer.pad_token, tokenizer.pad_token_id = (tokenizer.eos_token, tokenizer.eos_token_id)
    
        # Disable DynamicCache
        # See: https://github.com/tenstorrent/tt-buda/issues/42
        framework_model._supports_cache_class = False
    
        # Example usage
        batch_size = 1
        prompt = ["My name is Jim Keller and"] * batch_size
    
        inputs = tokenizer(prompt)
    
        input_ids = torch.tensor(inputs["input_ids"])
        attention_mask = torch.tensor(inputs["attention_mask"])
    
        inputs = [input_ids, attention_mask]
    
        # Forge compile framework model
        compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)
    
        # Model Verification
>       verify(inputs, framework_model, compiled_model)

forge/test/models/pytorch/text/qwen/test_qwen.py:54: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/verify.py:302: in verify
    co_out = compiled_model(*inputs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <forge.compiled_graph_state.CompiledModel object at 0x7f04eec02170>
inputs = (tensor([[ 5050,   829,   374, 11387, 65503,   323]]), tensor([[1, 1, 1, 1, 1, 1]]))
inputs_and_parameters = [tensor([[ 5050,   829,   374, 11387, 65503,   323]], dtype=torch.int32), tensor([[1, 1, 1, 1, 1, 1]], dtype=torch.int...., 0., 0.],
          [0., 0., 0.,  ..., 0., 1., 0.],
          [0., 0., 0.,  ..., 0., 0., 1.]]]]), tensor([-1.]), ...]

    def __call__(self, *inputs: AnyTensor) -> List[torch.Tensor]:
        """
        Run inference on the compiled model.
    
        Parameters
        ----------
        inputs: [Tensor, ...]
            Input tensors
    
        Returns
        -------
        List[Tensor]
            Output tensors
        """
        self.inputs = [*to_pt_tensors(inputs)]
        # After tensors are transformed to pt tensors, we have to cast them to dtypes that are actually supported by our hardware.
        self.inputs = [cast_unsupported_torch_dtype(input_tensor) for input_tensor in self.inputs]
    
        inputs_and_parameters = [
            *self.inputs,
            *self.fwd_compiled_graph_state.get_ordered_constant_tensors(),
            *self.fwd_compiled_graph_state.get_ordered_parameter_tensors(),
        ]
    
        assert all(
            [isinstance(t, torch.Tensor) for t in inputs_and_parameters]
        ), "All inputs should be torch tensors by now."
    
        if self.training() and isinstance(self.framework_module, PyTorchModule):
            for name, param in self.framework_module.module.named_parameters():
                if param.requires_grad:
                    our_tensor = self.fwd_compiled_graph_state.get_parameter_tensor(name)
    
                    # NOTE: for parameters that require gradients, we want to share the same tensor with the PyTorch
                    # module. This is because we want to be able to optimize the parameters both on the device
                    # (through our runtime) and via the torch optimizers. So this ensures that whichever side updates
                    # the parameter value, the other side can see the change.
                    #
                    # This could change in the future, but for now ensure that our premise is correct.
                    assert param is our_tensor
    
        logger.info(
            f"Running model {self.framework_module.get_name()} {self.fwd_compiled_graph_state.graph.get_name()} on device..."
        )
>       all_outputs = run_binary(self.compiled_binary, int(ProgramId.FORWARD), inputs_and_parameters)
E       RuntimeError: Input count mismatch: expected 533, got 534

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compiled_graph_state.py:266: RuntimeError

Check failure on line 48 in forge/test/models/pytorch/text/squeezebert/test_squeezebert.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_squeezebert.test_squeezebert_sequence_classification_pytorch[squeezebert/squeezebert-mnli]

RuntimeError: Failed to run MLIR compiler pass pipeline.
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04b692d060>
variant = 'squeezebert/squeezebert-mnli'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", ["squeezebert/squeezebert-mnli"])
    def test_squeezebert_sequence_classification_pytorch(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="squeezebert",
            variant=variant,
            task=Task.SEQUENCE_CLASSIFICATION,
            source=Source.HUGGINGFACE,
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        # Load Bart tokenizer and model from HuggingFace
        tokenizer = download_model(AutoTokenizer.from_pretrained, variant)
        framework_model = download_model(AutoModelForSequenceClassification.from_pretrained, variant)
    
        # Example from multi-nli validation set
        text = """Hello, my dog is cute"""
    
        # Data preprocessing
        input_tokens = tokenizer.encode(
            text,
            max_length=128,
            padding="max_length",
            truncation=True,
            return_tensors="pt",
        )
    
        inputs = [input_tokens]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/text/squeezebert/test_squeezebert.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_squeezebert_squeezebert_squeezebert_mnli_seq_cls_hf], graph_name='pt_squeezebert_squ...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f04b65b1730>, compiled_binary=None, attach_to=None)

    def run_mlir_compiler(context: CompileContext) -> CompileDepth:
        assert context.forge_module is not None
    
>       context.compiled_binary = forge._C.run_mlir_compiler(context.forge_module)
E       RuntimeError: Failed to run MLIR compiler pass pipeline.

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:986: RuntimeError

Check failure on line 90 in forge/test/models/pytorch/text/t5/test_t5.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_t5.test_t5_generation[google_flan_t5_small]

ValueError: Data mismatch -> AutomaticValueChecker (compare_with_golden): framework_model=tensor([[[-33.09930,  -0.46325,  -3.45816,  ..., -32.99524, -33.03175, -32.80392]]], grad_fn=<UnsafeViewBackward0>), compiled_model=tensor([[[-33.15955,  -0.68079,  -2.26280,  ..., -33.05084, -33.10480, -32.81152]]])
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04b6857c70>
variant = 'google/flan-t5-small'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants)
    def test_t5_generation(record_forge_property, variant):
        if variant not in {"t5-small", "google/flan-t5-small", "t5-base", "t5-large"}:
            pytest.skip(f"Skipping {variant} due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="t5", variant=variant, task=Task.TEXT_GENERATION, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        # Load tokenizer and model from HuggingFace
        # Variants: t5-small, t5-base, t5-large
    
        config = download_model(T5Config.from_pretrained, variant)
        config_dict = config.to_dict()
        config_dict["return_dict"] = False
        config_dict["use_cache"] = False
        config = T5Config(**config_dict)
        model = download_model(T5ForConditionalGeneration.from_pretrained, variant, config=config)
        tokenizer = AutoTokenizer.from_pretrained(variant)
    
        inputs = tokenizer(
            "summarize: Researchers have extensively studied the benefits of having pets, "
            "particularly dogs, on human health and well-being. Findings suggest that pet ownership "
            "can lead to improved mental health, reduced stress levels, and even physical health benefits "
            "such as lower blood pressure and increased physical activity levels due to regular walks.",
            return_tensors="pt",
        )
    
        input_ids = inputs.input_ids
        decoder_start_token_tensor = torch.tensor(model.generation_config.decoder_start_token_id, dtype=torch.long)
        decoder_input_ids = torch.ones((1, 1), dtype=torch.long) * decoder_start_token_tensor
        inputs = [input_ids, decoder_input_ids]
    
        class Wrapper(torch.nn.Module):
            def __init__(self, model):
                super().__init__()
                self.model = model
    
            def forward(self, input_ids, decoder_input_ids):
                inputs = {"input_ids": input_ids, "decoder_input_ids": decoder_input_ids}
                output = self.model(**inputs)
                return output
    
        framework_model = Wrapper(model)
    
        # Forge compile
        compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)
    
        # Model Verification
>       verify(inputs, framework_model, compiled_model)

forge/test/models/pytorch/text/t5/test_t5.py:90: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/verify.py:333: in verify
    verify_cfg.value_checker.check(fw, co)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <forge.verify.value_checkers.AutomaticValueChecker object at 0x7f04f5949420>
fw_out = tensor([[[-33.09930,  -0.46325,  -3.45816,  ..., -32.99524, -33.03175, -32.80392]]], grad_fn=<UnsafeViewBackward0>)
co_out = tensor([[[-33.15955,  -0.68079,  -2.26280,  ..., -33.05084, -33.10480, -32.81152]]])

    def check(self, fw_out, co_out):
        if not compare_with_golden(fw_out, co_out, self.pcc, self.rtol, self.atol, self.dissimilarity_threshold):
>           raise ValueError(
                f"Data mismatch -> AutomaticValueChecker (compare_with_golden): framework_model={fw_out}, compiled_model={co_out}"
            )
E           ValueError: Data mismatch -> AutomaticValueChecker (compare_with_golden): framework_model=tensor([[[-33.09930,  -0.46325,  -3.45816,  ..., -32.99524, -33.03175, -32.80392]]], grad_fn=<UnsafeViewBackward0>), compiled_model=tensor([[[-33.15955,  -0.68079,  -2.26280,  ..., -33.05084, -33.10480, -32.81152]]])

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/value_checkers.py:38: ValueError

Check failure on line 49 in forge/test/models/pytorch/timeseries/nbeats/test_nbeats.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_nbeats.test_nbeats_with_seasonality_basis[seasionality_basis]

RuntimeError: Tensor 4 - stride mismatch: expected [24, 1], got [1, 12]
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f03fed108e0>
variant = 'seasionality_basis'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", ["seasionality_basis"])
    def test_nbeats_with_seasonality_basis(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="nbeats", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        x, x_mask = get_electricity_dataset_input()
    
        framework_model = NBeatsWithSeasonalityBasis(
            input_size=72,
            output_size=24,
            num_of_harmonics=1,
            stacks=30,
            layers=4,
            layer_size=2048,
        )
        framework_model.eval()
    
        inputs = [x, x_mask]
    
        # Forge compile framework model
        compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)
    
        # Model Verification
>       verify(inputs, framework_model, compiled_model)

forge/test/models/pytorch/timeseries/nbeats/test_nbeats.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/verify.py:302: in verify
    co_out = compiled_model(*inputs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <forge.compiled_graph_state.CompiledModel object at 0x7f03fd819960>
inputs = (tensor([[[[ 160.50679,  156.32184,  146.39499,  ...,  264.03345,  169.91641,  163.64682],
          [  79.53951,   85...[1., 1., 1.,  ..., 1., 1., 1.],
          [1., 1., 1.,  ..., 1., 1., 1.],
          [1., 1., 1.,  ..., 1., 1., 1.]]]]))
inputs_and_parameters = [tensor([[[[ 160.50679,  156.32184,  146.39499,  ...,  264.03345,  169.91641,  163.64682],
          [  79.53951,   85...0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]]), ...]

    def __call__(self, *inputs: AnyTensor) -> List[torch.Tensor]:
        """
        Run inference on the compiled model.
    
        Parameters
        ----------
        inputs: [Tensor, ...]
            Input tensors
    
        Returns
        -------
        List[Tensor]
            Output tensors
        """
        self.inputs = [*to_pt_tensors(inputs)]
        # After tensors are transformed to pt tensors, we have to cast them to dtypes that are actually supported by our hardware.
        self.inputs = [cast_unsupported_torch_dtype(input_tensor) for input_tensor in self.inputs]
    
        inputs_and_parameters = [
            *self.inputs,
            *self.fwd_compiled_graph_state.get_ordered_constant_tensors(),
            *self.fwd_compiled_graph_state.get_ordered_parameter_tensors(),
        ]
    
        assert all(
            [isinstance(t, torch.Tensor) for t in inputs_and_parameters]
        ), "All inputs should be torch tensors by now."
    
        if self.training() and isinstance(self.framework_module, PyTorchModule):
            for name, param in self.framework_module.module.named_parameters():
                if param.requires_grad:
                    our_tensor = self.fwd_compiled_graph_state.get_parameter_tensor(name)
    
                    # NOTE: for parameters that require gradients, we want to share the same tensor with the PyTorch
                    # module. This is because we want to be able to optimize the parameters both on the device
                    # (through our runtime) and via the torch optimizers. So this ensures that whichever side updates
                    # the parameter value, the other side can see the change.
                    #
                    # This could change in the future, but for now ensure that our premise is correct.
                    assert param is our_tensor
    
        logger.info(
            f"Running model {self.framework_module.get_name()} {self.fwd_compiled_graph_state.graph.get_name()} on device..."
        )
>       all_outputs = run_binary(self.compiled_binary, int(ProgramId.FORWARD), inputs_and_parameters)
E       RuntimeError: Tensor 4 - stride mismatch: expected [24, 1], got [1, 12]

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compiled_graph_state.py:266: RuntimeError

Check failure on line 37 in forge/test/models/onnx/vision/fpn/test_fpn.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_fpn.test_fpn_pytorch

RuntimeError: Unknown type of tensor: <class 'collections.OrderedDict'>
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04b6806b90>

    @pytest.mark.nightly
    def test_fpn_pytorch(record_forge_property):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="fpn", source=Source.TORCHVISION, task=Task.IMAGE_CLASSIFICATION
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        # Load FPN model
        framework_model = FPNWrapper()
    
        feat0 = torch.rand(1, 256, 64, 64)
        feat1 = torch.rand(1, 512, 16, 16)
        feat2 = torch.rand(1, 2048, 8, 8)
    
        inputs = [feat0, feat1, feat2]
    
        # Forge compile framework model
        compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)
    
        # Model Verification
>       verify(inputs, framework_model, compiled_model)

forge/test/models/pytorch/vision/fpn/test_fpn.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/verify.py:306: in verify
    fw_out = to_pt_tensors(fw_out)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tensor.py:1176: in to_pt_tensors
    pytorch_tensors.append(to_pt_tensor(t))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

t = OrderedDict([('feat0', tensor([[[[ 0.93403,  1.39704,  1.38101,  ...,  1.04490,  1.05482,  0.64459],
          [ 1.160...-2.10200, -2.41374],
          [-2.25311, -2.57212, -2.51108, -2.30604]]]], grad_fn=<MaxPool2DWithIndicesBackward0>))])

    def to_pt_tensor(t: AnyTensor) -> torch.Tensor:
        if isinstance(t, torch.Tensor):
            return t
        elif isinstance(t, (tf.Tensor, tf.Variable)):
            pt = torch.Tensor(t.numpy() if t.dtype != tf.bfloat16 else tf.cast(t, tf.float32).numpy()).type(
                map_tf_dtype_to_pt(t.dtype)
            )
            pt.requires_grad = (
                t.trainable if isinstance(t, tf.Variable) else torch.is_complex(pt) or torch.is_floating_point(pt)
            )
            return pt
        elif isinstance(t, Tensor):
            assert t.has_value(), "Expected Forge tensor to have a value"
            return t.value()
        else:
>           raise RuntimeError(f"Unknown type of tensor: {type(t)}")
E           RuntimeError: Unknown type of tensor: <class 'collections.OrderedDict'>

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tensor.py:1196: RuntimeError

Check failure on line 59 in forge/test/models/pytorch/vision/googlenet/test_googlenet.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_googlenet.test_googlenet_pytorch

RuntimeError: TT_FATAL @ /__w/tt-forge-fe/tt-forge-fe/third_party/tt-mlir/third_party/tt-metal/src/tt-metal/ttnn/cpp/ttnn/tensor/tensor_utils.cpp:50: new_volume == old_volume
info:
Invalid arguments to reshape
backtrace:
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libTTMLIRRuntime.so(+0xbd288) [0x7f04fd71c288]
 --- tt::tt_metal::infer_dims_for_reshape(tt::tt_metal::Tensor const&, tt::stl::Span<int const, 18446744073709551615ul>)
 --- ttnn::operations::data_movement::ReshapeViewOperation::invoke(tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>, tt::tt_metal::Tensor const&, tt::stl::Span<int const, 18446744073709551615ul>, std::optional<tt::tt_metal::MemoryConfig> const&, std::optional<std::variant<unsigned int, float> > const&)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libTTMLIRRuntime.so(+0xe69c2) [0x7f04fd7459c2]
 --- tt::runtime::ttnn::operations::data_movement::run(tt::target::ttnn::ReshapeOp const*, tt::runtime::ttnn::ProgramContext&)
 --- tt::runtime::ttnn::runProgram(tt::tt_metal::distributed::MeshDevice&, tt::runtime::Binary, unsigned int, std::vector<tt::tt_metal::Tensor*, std::allocator<tt::tt_metal::Tensor*> > const&)
 --- tt::runtime::ttnn::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
 --- tt::runtime::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
 --- tt::run_binary(tt::runtime::Binary&, int, std::vector<at::Tensor, std::allocator<at::Tensor> > const&)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x318900) [0x7f0507a25900]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x31884e) [0x7f0507a2584e]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xe1e05) [0x7f05077eee05]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x18ab32) [0x555c8a024b32]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x59c7) [0x555c8a014a97]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0xc4) [0x555c8a01a574]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0x122) [0x555c8a033172]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x8af) [0x555c8a00f97f]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04b60f0b80>

    @pytest.mark.nightly
    def test_googlenet_pytorch(record_forge_property):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="googlenet", source=Source.TORCHVISION, task=Task.IMAGE_CLASSIFICATION
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        # Create Forge module from PyTorch model
        # Two ways to load the same model
        # model = torch.hub.load('pytorch/vision:v0.10.0', 'googlenet', pretrained=True)
        framework_model = download_model(models.googlenet, pretrained=True)
        framework_model.eval()
    
        # Image preprocessing
        try:
            torch.hub.download_url_to_file("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg")
            input_image = Image.open("dog.jpg")
            preprocess = transforms.Compose(
                [
                    transforms.Resize(256),
                    transforms.CenterCrop(224),
                    transforms.ToTensor(),
                    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
                ]
            )
            input_tensor = preprocess(input_image)
            input_batch = input_tensor.unsqueeze(0)  # create a mini-batch as expected by the model
        except:
            logger.warning(
                "Failed to download the image file, replacing input with random tensor. Please check if the URL is up to date"
            )
            input_batch = torch.rand(1, 3, 224, 224)
    
        inputs = [input_batch]
    
        # Forge compile framework model
        compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)
    
        # Model Verification
>       verify(inputs, framework_model, compiled_model)

forge/test/models/pytorch/vision/googlenet/test_googlenet.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/verify/verify.py:302: in verify
    co_out = compiled_model(*inputs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <forge.compiled_graph_state.CompiledModel object at 0x7f05fbe24ca0>
inputs = (tensor([[[[-1.92953, -1.92953, -1.91241,  ..., -2.03228, -1.94666, -1.92953],
          [-1.99803, -1.89528, -1.91241... ..., -0.95041, -1.49072, -1.38614],
          [-1.28157, -1.42100, -1.22928,  ..., -0.74126, -1.12471, -1.28157]]]]),)
inputs_and_parameters = [tensor([[[[-1.92953, -1.92953, -1.91241,  ..., -2.03228, -1.94666, -1.92953],
          [-1.99803, -1.89528, -1.91241...0., 0.,  ..., 0., 0., 0.],
          [0., 0., 0.,  ..., 0., 0., 0.],
          [0., 0., 0.,  ..., 0., 0., 0.]]]]), ...]

    def __call__(self, *inputs: AnyTensor) -> List[torch.Tensor]:
        """
        Run inference on the compiled model.
    
        Parameters
        ----------
        inputs: [Tensor, ...]
            Input tensors
    
        Returns
        -------
        List[Tensor]
            Output tensors
        """
        self.inputs = [*to_pt_tensors(inputs)]
        # After tensors are transformed to pt tensors, we have to cast them to dtypes that are actually supported by our hardware.
        self.inputs = [cast_unsupported_torch_dtype(input_tensor) for input_tensor in self.inputs]
    
        inputs_and_parameters = [
            *self.inputs,
            *self.fwd_compiled_graph_state.get_ordered_constant_tensors(),
            *self.fwd_compiled_graph_state.get_ordered_parameter_tensors(),
        ]
    
        assert all(
            [isinstance(t, torch.Tensor) for t in inputs_and_parameters]
        ), "All inputs should be torch tensors by now."
    
        if self.training() and isinstance(self.framework_module, PyTorchModule):
            for name, param in self.framework_module.module.named_parameters():
                if param.requires_grad:
                    our_tensor = self.fwd_compiled_graph_state.get_parameter_tensor(name)
    
                    # NOTE: for parameters that require gradients, we want to share the same tensor with the PyTorch
                    # module. This is because we want to be able to optimize the parameters both on the device
                    # (through our runtime) and via the torch optimizers. So this ensures that whichever side updates
                    # the parameter value, the other side can see the change.
                    #
                    # This could change in the future, but for now ensure that our premise is correct.
                    assert param is our_tensor
    
        logger.info(
            f"Running model {self.framework_module.get_name()} {self.fwd_compiled_graph_state.graph.get_name()} on device..."
        )
>       all_outputs = run_binary(self.compiled_binary, int(ProgramId.FORWARD), inputs_and_parameters)
E       RuntimeError: TT_FATAL @ /__w/tt-forge-fe/tt-forge-fe/third_party/tt-mlir/third_party/tt-metal/src/tt-metal/ttnn/cpp/ttnn/tensor/tensor_utils.cpp:50: new_volume == old_volume
E       info:
E       Invalid arguments to reshape
E       backtrace:
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libTTMLIRRuntime.so(+0xbd288) [0x7f04fd71c288]
E        --- tt::tt_metal::infer_dims_for_reshape(tt::tt_metal::Tensor const&, tt::stl::Span<int const, 18446744073709551615ul>)
E        --- ttnn::operations::data_movement::ReshapeViewOperation::invoke(tt::stl::StrongType<unsigned char, ttnn::QueueIdTag>, tt::tt_metal::Tensor const&, tt::stl::Span<int const, 18446744073709551615ul>, std::optional<tt::tt_metal::MemoryConfig> const&, std::optional<std::variant<unsigned int, float> > const&)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/lib/libTTMLIRRuntime.so(+0xe69c2) [0x7f04fd7459c2]
E        --- tt::runtime::ttnn::operations::data_movement::run(tt::target::ttnn::ReshapeOp const*, tt::runtime::ttnn::ProgramContext&)
E        --- tt::runtime::ttnn::runProgram(tt::tt_metal::distributed::MeshDevice&, tt::runtime::Binary, unsigned int, std::vector<tt::tt_metal::Tensor*, std::allocator<tt::tt_metal::Tensor*> > const&)
E        --- tt::runtime::ttnn::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
E        --- tt::runtime::submit(tt::runtime::Device, tt::runtime::Binary, unsigned int, std::vector<tt::runtime::Tensor, std::allocator<tt::runtime::Tensor> > const&)
E        --- tt::run_binary(tt::runtime::Binary&, int, std::vector<at::Tensor, std::allocator<at::Tensor> > const&)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x318900) [0x7f0507a25900]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x31884e) [0x7f0507a2584e]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xe1e05) [0x7f05077eee05]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x18ab32) [0x555c8a024b32]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x59c7) [0x555c8a014a97]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0xc4) [0x555c8a01a574]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0x122) [0x555c8a033172]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x8af) [0x555c8a00f97f]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x555c8a03310b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x555c8a011c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x555c8a0109ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x555c8a0324d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x555c8a014702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x555c8a01a61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x555c8a02f62c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x555c8a137464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x555c8a01b39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x555c8a01599e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x555c8a02538c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x555c8a00f790]

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compiled_graph_state.py:266: RuntimeError

Check failure on line 96 in forge/test/models/pytorch/vision/hrnet/test_hrnet.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_hrnet.test_hrnet_osmr_pytorch[hrnet_w18_small_v1]

RuntimeError: Failed to run MLIR compiler pass pipeline.
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04bdbc46a0>
variant = 'hrnet_w18_small_v1'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_hrnet_osmr_pytorch(record_forge_property, variant):
        if variant != "hrnet_w18_small_v1":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="hrnet", variant=variant, source=Source.OSMR, task=Task.POSE_ESTIMATION
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        framework_model, inputs, _ = generate_model_hrnet_imgcls_osmr_pytorch(
            variant,
        )
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/vision/hrnet/test_hrnet.py:96: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_hrnet_hrnet_w18_small_v1_pose_estimation_osmr], graph_name='pt_hrnet_hrnet_w18_small...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f0421ff52f0>, compiled_binary=None, attach_to=None)

    def run_mlir_compiler(context: CompileContext) -> CompileDepth:
        assert context.forge_module is not None
    
>       context.compiled_binary = forge._C.run_mlir_compiler(context.forge_module)
E       RuntimeError: Failed to run MLIR compiler pass pipeline.

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:986: RuntimeError

Check failure on line 53 in forge/test/models/pytorch/vision/vit/test_vit.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_vit.test_vit_classify_224_hf_pytorch[google/vit-base-patch16-224]

RuntimeError: Failed to run MLIR compiler pass pipeline.
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04b04282e0>
variant = 'google/vit-base-patch16-224'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_vit_classify_224_hf_pytorch(record_forge_property, variant):
        if variant != "google/vit-base-patch16-224":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="vit",
            variant=variant,
            task=Task.IMAGE_CLASSIFICATION,
            source=Source.HUGGINGFACE,
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        framework_model, inputs, _ = generate_model_vit_imgcls_hf_pytorch(variant)
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/vision/vit/test_vit.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_vit_google_vit_base_patch16_224_img_cls_hf], graph_name='pt_vit_google_vit_base_patc...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f04deedee70>, compiled_binary=None, attach_to=None)

    def run_mlir_compiler(context: CompileContext) -> CompileDepth:
        assert context.forge_module is not None
    
>       context.compiled_binary = forge._C.run_mlir_compiler(context.forge_module)
E       RuntimeError: Failed to run MLIR compiler pass pipeline.

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:986: RuntimeError

Check failure on line 52 in forge/test/models/onnx/vision/yolo/test_yolo_v5.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_yolo_v5.test_yolov5_320x320[yolov5s]

RuntimeError: Failed to run MLIR compiler pass pipeline.
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f054862bd00>
size = 's'

    @pytest.mark.nightly
    @pytest.mark.parametrize("size", size, ids=["yolov5" + s for s in size])
    def test_yolov5_320x320(record_forge_property, size):
        if size != "s":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="yolo_v5",
            variant="yolov5" + size,
            task="imgcls",
            source="torchhub",
            suffix="320x320",
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        framework_model, inputs, _ = generate_model_yoloV5I320_imgcls_torchhub_pytorch(
            "ultralytics/yolov5",
            size=size,
        )
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/vision/yolo/test_yolo_v5.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_yolo_v5_yolov5s_imgcls_torchhub_320x320], graph_name='pt_yolo_v5_yolov5s_imgcls_torc...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f04aeeab0f0>, compiled_binary=None, attach_to=None)

    def run_mlir_compiler(context: CompileContext) -> CompileDepth:
        assert context.forge_module is not None
    
>       context.compiled_binary = forge._C.run_mlir_compiler(context.forge_module)
E       RuntimeError: Failed to run MLIR compiler pass pipeline.

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:986: RuntimeError

Check failure on line 68 in forge/test/models/pytorch/vision/yolo/test_yolo_v6.py

See this annotation in the file changed.

@github-actions github-actions / TT-Forge-FE Tests

test_yolo_v6.test_yolo_v6_pytorch[yolov6n]

RuntimeError: Found Unsupported operations while lowering from TTForge to TTIR in forward graph
Raw output
record_forge_property = <test.conftest.ForgePropertyStore object at 0x7f04ae0cb670>
variant = 'yolov6n'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants)
    def test_yolo_v6_pytorch(record_forge_property, variant):
        if variant != "yolov6n":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="yolo_v6",
            variant=variant,
            source=Source.TORCH_HUB,
            task=Task.OBJECT_DETECTION,
        )
    
        # Record Forge Property
        record_forge_property("tags.model_name", module_name)
    
        # STEP 2 :prepare model
        url = f"https://github.com/meituan/YOLOv6/releases/download/0.3.0/{variant}.pt"
        weights = f"{variant}.pt"
    
        try:
            response = requests.get(url)
            with open(weights, "wb") as file:
                file.write(response.content)
            print(f"Downloaded {url} to {weights}")
        except Exception as e:
            print(f"Error downloading {url}: {e}")
    
        model = YOLOV6(weights)
        framework_model = model.model
        framework_model.eval()
    
        # STEP 3 : prepare input
        url = "http://images.cocodataset.org/val2017/000000397133.jpg"
        stride = 32
        input_size = 640
        img_size = check_img_size(input_size, s=stride)
        img, img_src = process_image(url, img_size, stride, half=False)
        input_batch = img.unsqueeze(0)
    
        inputs = [input_batch]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/vision/yolo/test_yolo_v6.py:68: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_yolo_v6_yolov6n_obj_det_torchhub], graph_name='pt_yolo_v6_yolov6n_obj_det_torchhub',...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f03cc60a430>, compiled_binary=None, attach_to=None)

    def run_mlir_compiler(context: CompileContext) -> CompileDepth:
        assert context.forge_module is not None
    
>       context.compiled_binary = forge._C.run_mlir_compiler(context.forge_module)
E       RuntimeError: Found Unsupported operations while lowering from TTForge to TTIR in forward graph

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:986: RuntimeError