Skip to content

On PR

On PR #2296

GitHub Actions / TT-Forge-FE Tests failed Jan 31, 2025 in 0s

97 tests run, 6 passed, 76 skipped, 15 failed.

Annotations

Check failure on line 59 in forge/test/models/pytorch/text/distilbert/test_distilbert.py

See this annotation in the file changed.

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

test_distilbert.test_distilbert_masked_lm_pytorch[distilbert-base-uncased]

RuntimeError: Generated MLIR module failed verification.
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3e96641750>
variant = 'distilbert-base-uncased'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_distilbert_masked_lm_pytorch(record_forge_property, variant):
        if variant != "distilbert-base-uncased":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="distilbert", variant=variant, task=Task.MASKED_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Load DistilBert tokenizer and model from HuggingFace
        # Variants: distilbert-base-uncased, distilbert-base-cased,
        # distilbert-base-multilingual-cased
        # NOTE: These model variants are pre-trined only. They need to be fine-tuned
        # on a downstream task. Code is for demonstration purposes only.
        tokenizer = download_model(DistilBertTokenizer.from_pretrained, variant)
        framework_model = download_model(DistilBertForMaskedLM.from_pretrained, variant)
    
        # Load data sample
        sample_text = "The capital of France is [MASK]."
    
        # Data preprocessing
        input_tokens = tokenizer(
            sample_text,
            max_length=128,
            padding="max_length",
            truncation=True,
            return_tensors="pt",
        )
    
        inputs = [input_tokens["input_ids"], input_tokens["attention_mask"]]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/text/distilbert/test_distilbert.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_distilbert_distilbert_base_uncased_mlm_hf], graph_name='pt_distilbert_distilbert_bas...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f3e9641a730>, 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: Generated MLIR module failed verification.

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

Check failure on line 83 in forge/test/models/pytorch/text/fuyu/test_fuyu_8b.py

See this annotation in the file changed.

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

test_fuyu_8b.test_fuyu8b[adept/fuyu-8b]

RuntimeError: TT_ASSERT @ /__w/tt-forge-fe/tt-forge-fe/forge/csrc/graph_lib/shape.cpp:135: (i >= 0) && (i < (int)dims_.size())
info:
Trying to access element outside of dimensions: 3
backtrace:
 --- tt::graphlib::Shape::operator[](int)
 --- tt::passes::commute_through_concat(tt::graphlib::Graph*, tt::graphlib::OpNode*, tt::graphlib::OpNode*, tt::graphlib::Node*, tt::graphlib::Shape*, tt::graphlib::Shape*, bool, bool*, std::pair<int, int>*, tt::graphlib::OpType*, bool)
 --- tt::passes::can_commute_past_op(tt::graphlib::OpNode*, tt::graphlib::OpNode*, tt::graphlib::Graph*, tt::graphlib::Shape*, tt::graphlib::Shape*, bool, tt::graphlib::Node*)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fc4f) [0x7f3dc7ac7c4f]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fd9d) [0x7f3dc7ac7d9d]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fd9d) [0x7f3dc7ac7d9d]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fd9d) [0x7f3dc7ac7d9d]
 --- tt::passes::erase_inverse_ops(tt::graphlib::Graph*)
 --- tt::run_optimization_graph_passes(tt::graphlib::Graph*)
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xfda39) [0x7f3dc7a35a39]
 --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xe0cf5) [0x7f3dc7a18cf5]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x18ab32) [0x56504c556b32]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x59c7) [0x56504c546a97]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0x122) [0x56504c565172]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x56504c54799e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x8af) [0x56504c54197f]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
 --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x56504c56510b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x56504c54799e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
 --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x56504c54799e]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
 --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3c4134ed40>
variant = 'adept/fuyu-8b'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", ["adept/fuyu-8b"])
    def test_fuyu8b(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="fuyu", variant=variant, task=Task.QA, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        config = FuyuConfig.from_pretrained(variant)
        config_dict = config.to_dict()
        config_dict["return_dict"] = False
        config_dict["use_cache"] = False
        config_dict["text_config"]["num_hidden_layers"] = 1
        config = FuyuConfig(**config_dict)
    
        # Load post-processing modules  (run on CPU)
        tokenizer = AutoTokenizer.from_pretrained(variant)
        image_processor = FuyuImageProcessor()
        processor = FuyuProcessor(image_processor=image_processor, tokenizer=tokenizer)
    
        # Create Forge module from PyTorch model
        fuyu_model = FuyuForCausalLM.from_pretrained(variant, config=config)
        # fuyu_model = FuyuForCausalLM(config=config)
        framework_model = FuyuModelWrapper(fuyu_model)
        framework_model.eval()
    
        # Prepare inputs
        text_prompt = "Generate a coco-style caption.\n"
    
        url = "https://huggingface.co/adept-hf-collab/fuyu-8b/resolve/main/bus.png"
        response = requests.get(url)
        with open("bus.png", "wb") as file:
            file.write(response.content)
    
        image_path = "bus.png"  # https://huggingface.co/adept-hf-collab/fuyu-8b/blob/main/bus.png
    
        image_pil = Image.open(image_path)
        model_inputs = processor(text=text_prompt, images=[image_pil], device="cpu", return_tensor="pt")
        inputs_embeds = generate_fuyu_embedding(
            fuyu_model, model_inputs["input_ids"], model_inputs["image_patches"][0], model_inputs["image_patches_indices"]
        )
        inputs_embeds = inputs_embeds.clone().detach()
    
        inputs = [inputs_embeds]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/text/fuyu/test_fuyu_8b.py:83: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_fuyu_adept_fuyu_8b_qa_hf], graph_name='pt_fuyu_adept_fuyu_8b_qa_hf', compiler_cfg=Co...in_recompile=False, recompile_count=0, target_cycles_offset=0, forge_module=None, compiled_binary=None, attach_to=None)

    def run_optimization_pass(context: CompileContext) -> CompileDepth:
        """
        Runs optimization passes.
    
        Parameters
        ----------
        context: CompileContext
            Compile context
    
        Returns
        -------
        CompileDepth - next compile stage
        """
        compiler_cfg = context.compiler_cfg
        graph_name = context.graph_name
        graph, intermediate_tensors = context.graph, context.intermediate_tensors
    
>       run_optimization_graph_passes(graph)
E       RuntimeError: TT_ASSERT @ /__w/tt-forge-fe/tt-forge-fe/forge/csrc/graph_lib/shape.cpp:135: (i >= 0) && (i < (int)dims_.size())
E       info:
E       Trying to access element outside of dimensions: 3
E       backtrace:
E        --- tt::graphlib::Shape::operator[](int)
E        --- tt::passes::commute_through_concat(tt::graphlib::Graph*, tt::graphlib::OpNode*, tt::graphlib::OpNode*, tt::graphlib::Node*, tt::graphlib::Shape*, tt::graphlib::Shape*, bool, bool*, std::pair<int, int>*, tt::graphlib::OpType*, bool)
E        --- tt::passes::can_commute_past_op(tt::graphlib::OpNode*, tt::graphlib::OpNode*, tt::graphlib::Graph*, tt::graphlib::Shape*, tt::graphlib::Shape*, bool, tt::graphlib::Node*)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fc4f) [0x7f3dc7ac7c4f]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fd9d) [0x7f3dc7ac7d9d]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fd9d) [0x7f3dc7ac7d9d]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0x18fd9d) [0x7f3dc7ac7d9d]
E        --- tt::passes::erase_inverse_ops(tt::graphlib::Graph*)
E        --- tt::run_optimization_graph_passes(tt::graphlib::Graph*)
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xfda39) [0x7f3dc7a35a39]
E        --- /opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/_C.so(+0xe0cf5) [0x7f3dc7a18cf5]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x18ab32) [0x56504c556b32]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x59c7) [0x56504c546a97]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0x122) [0x56504c565172]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x56504c54799e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x8af) [0x56504c54197f]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
E        --- /opt/ttforge-toolchain/venv/bin/python(PyObject_Call+0xbb) [0x56504c56510b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x56504c54799e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x18db) [0x56504c5429ab]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x1984d1) [0x56504c5644d1]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x5632) [0x56504c546702]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_FastCallDictTstate+0x16d) [0x56504c54c61d]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_Call_Prepend+0x5c) [0x56504c56162c]
E        --- /opt/ttforge-toolchain/venv/bin/python(+0x29d464) [0x56504c669464]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyObject_MakeTpCall+0x25b) [0x56504c54d39b]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x68ce) [0x56504c54799e]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x6c0) [0x56504c541790]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyFunction_Vectorcall+0x7c) [0x56504c55738c]
E        --- /opt/ttforge-toolchain/venv/bin/python(_PyEval_EvalFrameDefault+0x2b60) [0x56504c543c30]

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

Check failure on line 63 in forge/test/models/pytorch/text/opt/test_opt.py

See this annotation in the file changed.

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

test_opt.test_opt_causal_lm[facebook/opt-125m]

RuntimeError: Found Unsupported operations while lowering from TTForge to TTIR in forward graph
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3dada8c820>
variant = 'facebook/opt-125m'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_opt_causal_lm(record_forge_property, variant):
        if variant != "facebook/opt-125m":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="opt", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Load tokenizer and model from HuggingFace
        # Variants: "facebook/opt-125m", "facebook/opt-350m", "facebook/opt-1.3b"
    
        config = OPTConfig.from_pretrained(variant)
        config_dict = config.to_dict()
        config_dict["return_dict"] = False
        config_dict["use_cache"] = False
        config = OPTConfig(**config_dict)
    
        framework_model = download_model(OPTForCausalLM.from_pretrained, variant, config=config)
    
        tokenizer = download_model(AutoTokenizer.from_pretrained, variant)
        tokenizer.pad_token = tokenizer.eos_token
    
        # Input sample
        prefix_text = "My name is Thomas and my main"
        input_tokens = tokenizer(
            prefix_text,
            max_length=256,
            padding="max_length",
            truncation=True,
            return_tensors="pt",
        )
    
        inputs = [input_tokens["input_ids"], input_tokens["attention_mask"]]
    
        # Forge compile framework model
>       compiled_model = forge.compile(
            framework_model,
            inputs,
            module_name,
        )

forge/test/models/pytorch/text/opt/test_opt.py:63: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_opt_facebook_opt_125m_clm_hf], graph_name='pt_opt_facebook_opt_125m_clm_hf', compile...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f3c4141ce70>, 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:976: RuntimeError

Check failure on line 67 in forge/test/models/pytorch/text/phi2/test_phi2.py

See this annotation in the file changed.

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

test_phi2.test_phi2_clm[microsoft/phi-2]

AssertionError: Data mismatch on output 0 between framework and Forge codegen
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3c1dc9e680>
variant = 'microsoft/phi-2'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_phi2_clm(record_forge_property, variant):
        if variant != "microsoft/phi-2":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="phi2", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Load PhiConfig from pretrained variant, disable return_dict and caching.
        config = PhiConfig.from_pretrained(variant)
        config_dict = config.to_dict()
        config_dict["return_dict"] = False
        config_dict["use_cache"] = False
        config = PhiConfig(**config_dict)
    
        # Load model and tokenizer from HuggingFace
        framework_model = PhiForCausalLM.from_pretrained(variant, trust_remote_code=True, config=config)
        framework_model.eval()
        tokenizer = AutoTokenizer.from_pretrained(variant, return_tensors="pt", trust_remote_code=True)
        tokenizer.add_special_tokens({"pad_token": "[PAD]"})
    
        # input_prompt
        input_prompt = "Write a detailed analogy between mathematics and a lighthouse."
    
        # Tokenize input
        inputs = tokenizer(
            input_prompt,
            return_tensors="pt",
            max_length=256,
            pad_to_max_length=True,
            truncation=True,
        )
    
        input_ids = inputs["input_ids"].to(torch.int32)
        attn_mask = inputs["attention_mask"].to(torch.float32)
    
        inputs = [input_ids, attn_mask]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/text/phi2/test_phi2.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: 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:678: in generate_initial_graph
    module, module_inputs = convert_to_forge_module(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:1021: 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:2140: in generate_forge_module
    verify_framework_vs_forge_codegen(framework_outputs, forge_outputs, verify_cfg=verify_cfg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

frame_outputs = [tensor([[[ 6.17570,  8.31607,  4.25982,  ..., -1.74712, -1.74752, -1.74717],
         [ 5.07650,  3.62573,  1.85686, ...76, -3.92538],
         [ 8.07227, 11.88670, 11.73315,  ..., -3.90534, -3.90513, -3.90662]]], grad_fn=<ViewBackward0>)]
forge_outputs = (Forge Tensor: tensor([[[ 6.17487,  8.31714,  4.26098,  ..., -1.74720, -1.74759, -1.74724],
         [ 5.07509,  3.625...    [10.83251, 14.59320, 13.97819,  ...,  1.54459,  1.54360,  1.54447]]], grad_fn=<AddBackward0>), DataFormat.Float32,)
verify_cfg = DepricatedVerifyConfig(graph_name='graph', enabled=False, intermediates=False, rtol={torch.float32: None, torch.float1...ent_checking=True, enable_parameter_gradient_checking=True, _input_gradient_queue=None, _parameter_gradient_queue=None)

    def verify_framework_vs_forge_codegen(frame_outputs, forge_outputs, verify_cfg):
        from forge.verify.compare import compare_tensor_to_golden
    
        test_pass = True
        for i, (golden, output) in enumerate(zip(frame_outputs, forge_outputs)):
            test_pass &= compare_tensor_to_golden(
                f"Framework vs. Forge codegen output {i}", golden, output.value(), is_forge=False, verify_cfg=verify_cfg
            )
    
>           assert test_pass, f"Data mismatch on output {i} between framework and Forge codegen"
E           AssertionError: Data mismatch on output 0 between framework and Forge codegen

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tvm_to_python.py:1987: AssertionError

Check failure on line 59 in forge/test/models/pytorch/text/qwen/test_qwen_v2.py

See this annotation in the file changed.

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

test_qwen_v2.test_qwen_clm[Qwen/Qwen2.5-0.5B]

RuntimeError: Input count mismatch: expected 534, got 535
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6e0ab490>
variant = 'Qwen/Qwen2.5-0.5B'

    @pytest.mark.parametrize("variant", variants, ids=variants)
    @pytest.mark.nightly
    def test_qwen_clm(record_forge_property, variant):
        if variant != "Qwen/Qwen2.5-0.5B":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="qwen_v2", variant=variant, task=Task.CAUSAL_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Load model and tokenizer
        framework_model = AutoModelForCausalLM.from_pretrained(variant, device_map="cpu")
        framework_model.config.return_dict = False
        tokenizer = AutoTokenizer.from_pretrained(variant)
    
        # Prepare input
        prompt = "Give me a short introduction to large language models."
        messages = [{"role": "user", "content": prompt}]
        text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
    
        # Tokenize and generate
        model_inputs = tokenizer([text], return_tensors="pt")
        input_ids = model_inputs["input_ids"]
        attention_mask = model_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_v2.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 0x7f3d7e77f370>
inputs = (tensor([[151644,   8948,    198,   2610,    525,    264,  10950,  17847,     13, 151645,    198, 151644,    872,    1...,  77091,    198]]), tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]))
inputs_and_parameters = [tensor([[151644,   8948,    198,   2610,    525,    264,  10950,  17847,     13, 151645,    198, 151644,    872,    1...., 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)]
    
        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 534, got 535

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

Check failure on line 49 in forge/test/models/pytorch/text/roberta/test_roberta.py

See this annotation in the file changed.

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

test_roberta.test_roberta_masked_lm[xlm-roberta-base]

RuntimeError: Found Unsupported operations while lowering from TTForge to TTIR in forward graph
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d76d215a0>
variant = 'xlm-roberta-base'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", ["xlm-roberta-base"])
    def test_roberta_masked_lm(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="roberta", variant=variant, task=Task.MASKED_LM, source=Source.HUGGINGFACE
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Load Albert tokenizer and model from HuggingFace
        tokenizer = download_model(AutoTokenizer.from_pretrained, variant)
        framework_model = download_model(AutoModelForMaskedLM.from_pretrained, variant)
    
        # Input processing
        text = "Hello I'm a <mask> model."
        input_tokens = tokenizer.encode(
            text,
            max_length=128,
            padding="max_length",
            truncation=True,
            return_tensors="pt",
        )
        attention_mask = torch.zeros_like(input_tokens)
        attention_mask[input_tokens != 1] = 1
    
        inputs = [input_tokens, attention_mask]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/text/roberta/test_roberta.py:49: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_roberta_xlm_roberta_base_mlm_hf], graph_name='pt_roberta_xlm_roberta_base_mlm_hf', c...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f3c414d0930>, 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:976: RuntimeError

Check failure on line 168 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[t5-base]

ValueError: Data mismatch -> AutomaticValueChecker (compare_with_golden): framework_model=tensor([[[-18.88008, -10.41466, -14.89029,  ..., -43.63987, -43.76200, -43.71424]]], grad_fn=<UnsafeViewBackward0>), compiled_model=tensor([[[-31.69363, -10.19963, -13.79479,  ..., -44.44143, -44.45059, -44.40383]]])
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6e0ab760>
variant = 't5-base'

    @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("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:168: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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 0x7f3db1e1c310>
fw_out = tensor([[[-18.88008, -10.41466, -14.89029,  ..., -43.63987, -43.76200, -43.71424]]], grad_fn=<UnsafeViewBackward0>)
co_out = tensor([[[-31.69363, -10.19963, -13.79479,  ..., -44.44143, -44.45059, -44.40383]]])

    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([[[-18.88008, -10.41466, -14.89029,  ..., -43.63987, -43.76200, -43.71424]]], grad_fn=<UnsafeViewBackward0>), compiled_model=tensor([[[-31.69363, -10.19963, -13.79479,  ..., -44.44143, -44.45059, -44.40383]]])

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

Check failure on line 63 in forge/test/models/pytorch/vision/deit/test_deit.py

See this annotation in the file changed.

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

test_deit.test_deit_imgcls_hf_pytorch[facebook/deit-base-patch16-224]

RuntimeError: Failed to run MLIR compiler pass pipeline.
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6dacaa70>
variant = 'facebook/deit-base-patch16-224'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_deit_imgcls_hf_pytorch(record_forge_property, variant):
        if variant != "facebook/deit-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="deit",
            variant=variant,
            task=Task.IMAGE_CLASSIFICATION,
            source=Source.HUGGINGFACE,
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        framework_model, inputs, _ = generate_model_deit_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/deit/test_deit.py:63: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_deit_facebook_deit_base_patch16_224_img_cls_hf], graph_name='pt_deit_facebook_deit_b...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f3d6d3c08f0>, 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:976: RuntimeError

Check failure on line 52 in forge/test/models/pytorch/vision/densenet/test_densenet.py

See this annotation in the file changed.

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

test_densenet.test_densenet_121_pytorch[densenet121_hf_xray]

AssertionError: Encountered unsupported op types. Check error logs for more details
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6dfb9090>
variant = 'densenet121_hf_xray'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants, ids=variants)
    def test_densenet_121_pytorch(record_forge_property, variant):
        if variant == "densenet121":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="densenet",
            variant=variant,
            source=Source.TORCHVISION,
            task=Task.IMAGE_CLASSIFICATION,
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # STEP 2: Create Forge module from PyTorch model
        if variant == "densenet121":
            framework_model = download_model(torch.hub.load, "pytorch/vision:v0.10.0", "densenet121", pretrained=True)
            img_tensor = get_input_img()
        else:
            model_name = "densenet121-res224-all"
            framework_model = download_model(xrv.models.get_model, model_name)
            img_tensor = get_input_img_hf_xray()
    
        # STEP 3: Run inference on Tenstorrent device
        inputs = [img_tensor]
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/vision/densenet/test_densenet.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: 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:678: in generate_initial_graph
    module, module_inputs = convert_to_forge_module(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:1021: 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:2078: in generate_forge_module
    module_writers, flattened_inputs = compile_tvm_to_python(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

framework_mod = Module pt_densenet_densenet121_hf_xray_img_cls_torchvision
graph_name = 'pt_densenet_densenet121_hf_xray_img_cls_torchvision'
inputs = (tensor([[[[-712.15186, -765.86487, -753.21637,  ..., -505.60172, -514.56000, -465.37881],
          [-730.93268, -808... 679.86578,  585.54761],
          [ 355.91992,  428.24246,  472.22757,  ...,  602.73462,  600.47522,  519.48193]]]]),)
module_name = 'pt_densenet_densenet121_hf_xray_img_cls_torchvision_11'
compiler_cfg = CompilerConfig(enable_training=False, enable_recompute=False, match_subgraph_patterns=None, balancer_policy='default',...scheduler_constraints=[], paddings={}, op_intermediates_to_save=[], tti_dump_format=<TTIDumpFormat.DEFAULT: 'DEFAULT'>)
verify_cfg = DepricatedVerifyConfig(graph_name='graph', enabled=False, intermediates=False, rtol={torch.float32: None, torch.float1...ent_checking=True, enable_parameter_gradient_checking=True, _input_gradient_queue=None, _parameter_gradient_queue=None)
input_names = []

    def compile_tvm_to_python(
        framework_mod, graph_name, inputs, module_name=None, compiler_cfg=None, verify_cfg=None, input_names=[]
    ):
        if compiler_cfg is None:
            compiler_cfg = _get_global_compiler_config()
    
        is_training = False if verify_cfg == None else verify_cfg.test_kind.is_training()
    
        framework = get_framework(framework_mod)
        if framework == "pytorch":
            if is_training:
                framework_mod.module.train()
                verify_cfg.verify_tvm_compile = False
                logger.warning("Cannot verify TVM output vs. framework in training mode.")
            else:
                framework_mod.module.eval()
    
        # Path is needed for Onnx model verification against TVM compile.
        path = None
        if isinstance(framework_mod, OnnxModule):
            path = framework_mod.onnx_path
        elif isinstance(framework_mod, TFLiteModule):
            path = framework_mod.tflite_path
    
        # Load here to avoid importing tvm unnecessarily when this file is loaded
        from tvm.contrib.forge_compile import load_tvm_graph
    
        json_graphs, flattened_pytorch_inputs, weights = load_tvm_graph(
            inputs,
            framework_mod.module,
            compiler_cfg,
            graph_name,
            framework,
            path=path,
            verify_cfg=verify_cfg,
            input_names=input_names,
        )
    
        def _determine_node_dtype(node):
            if "framework_dtype" in node["attrs"].keys() and node["attrs"]["framework_dtype"] != "N/A":
                return node["attrs"]["framework_dtype"]
            else:
                logger.debug(
                    f"Node '{node['forge_name']}' does not have a framework dtype specified. Using TVM generated dtype."
                )
                return node["attrs"]["dtype"][0][0]
    
        span_lexer = re.compile("\S+$").search
    
        def span_to_src_layer(node):
            if "span" not in node["attrs"]:
                return None
            match = span_lexer(node["attrs"]["span"])
            return match.group(0) if match is not None else None
    
        modules = []
        for graph_index, json_graph in enumerate(json_graphs):
            graph = json.loads(json_graph["graph"])
    
            is_cpu_pre = graph_index == 0 and json_graph["device"] == "cpu"
    
            output_nodes = [head[0] for head in graph["heads"]]
            # reshape nops are added in tvm to passthrough nodes, prune them
            def is_nop_reshape(nid):
                node = graph["nodes"][nid]
                if node["name"] != "reshape":
                    return False
    
                input_shape = graph["nodes"][node["inputs"][0][0]]["attrs"]["shape"]
                node_shape = node["attrs"]["shape"]
                return input_shape == node_shape
    
            input_nodes = graph["arg_nodes"]
    
            graph_input_names = {}
            params = {}
            constants = {}
            ops = {}
            returns = {}
            returns_requiring_batch_dim_fix = []
            forge_inputs = [None] * len(flattened_pytorch_inputs)
            params_from_tvm = {}
            node_name_to_node_type = {}
    
            def make_parser_friendly_name(node, node_type):
                if framework == "tensorflow" or framework == "tf_graphdef" or framework == "jax":
                    node["forge_name"] = node["forge_name"].replace(".", "_").replace("/", "_")
                elif framework == "pytorch":
                    node["forge_name"] = node["forge_name"].replace(".", "_")
                elif framework == "onnx":
                    node["forge_name"] = node["forge_name"].replace(".", "_").replace("/", "_").replace(":", "_")
                elif framework == "tflite":
                    node["forge_name"] = node["forge_name"].replace(".", "_").replace("/", "_").replace(":", "_")
    
                # Preventing variable names starting with an integer in generated python
                if node["forge_name"][0] in [f"{n}" for n in range(10)]:
                    node["forge_name"] = f"{node_type}_{node['name']}"
    
            # Clean up Forge name
            for node in graph["nodes"]:
                node["forge_name"] = node["name"]
    
            # Check for unsupported ops
            has_unsupported_ops = False
            json_graph_op_map = tvm_to_forge_op_map if json_graph["device"] == "tt" else tvm_to_pytorch_op_map
            for nid, node in enumerate(graph["nodes"]):
                if node["op"] != "kernel":
                    continue
    
                if node["name"] not in json_graph_op_map:
                    has_unsupported_ops = True
                    unsupported_msg = (
                        f"Encountered unsupported op node type: {node['name']}, on device: {json_graph['device']}"
                    )
                    logger.warning(unsupported_msg) if compiler_cfg.enable_tvm_unsupported_ops else logger.error(
                        unsupported_msg
                    )
            if has_unsupported_ops:
>               assert (
                    compiler_cfg.enable_tvm_unsupported_ops
                ), "Encountered unsupported op types. Check error logs for more details"
E               AssertionError: Encountered unsupported op types. Check error logs for more details

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tvm_to_python.py:2263: AssertionError

Check failure on line 42 in forge/test/models/pytorch/vision/detr/test_detr.py

See this annotation in the file changed.

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

test_detr.test_detr_detection[facebook/detr-resnet-50]

AttributeError: <class 'tvm.ir.op.Op'> has no attribute name_hint
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3c1dd781f0>
variant = 'facebook/detr-resnet-50'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", ["facebook/detr-resnet-50"])
    def test_detr_detection(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="detr",
            variant=variant,
            task=Task.OBJECT_DETECTION,
            source=Source.HUGGINGFACE,
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Load the model
        framework_model = DetrForObjectDetection.from_pretrained(variant)
    
        # Preprocess the image for the model
        image_url = "http://images.cocodataset.org/val2017/000000397133.jpg"
        input_batch = preprocess_input_data(image_url)
    
        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/detr/test_detr.py:42: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: 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:678: in generate_initial_graph
    module, module_inputs = convert_to_forge_module(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:1021: 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:2078: in generate_forge_module
    module_writers, flattened_inputs = compile_tvm_to_python(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tvm_to_python.py:2172: in compile_tvm_to_python
    json_graphs, flattened_pytorch_inputs, weights = load_tvm_graph(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/tvm/contrib/forge_compile.py:106: in load_tvm_graph
    json_graphs, flattened_inputs = compile_tvm_graph(inputs, module, compiler_cfg, graph_name=graph_name, input_names=input_names, path=path, verify_cfg=verify_cfg, framework=framework)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/tvm/contrib/forge_compile.py:146: in compile_tvm_graph
    json_graphs, inputs = compile_pytorch_for_forge(module, *inputs, graph_name=graph_name, compiler_cfg=compiler_cfg, verify_cfg=verify_cfg, input_names=input_names)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/tvm/contrib/forge_compile.py:396: in compile_pytorch_for_forge
    json_graphs = extract_graphs(partitioned_mod, forge_params, flattened_input_names, torchmod.state_dict().keys(), graph_hash=m.hexdigest())
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/tvm/contrib/forge_compile.py:215: in extract_graphs
    if op.name_hint != cpu_pre_function:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Op(zeros), name = 'name_hint'

    def __getattr__(self, name):
        # specially check handle since
        # this is required for PackedFunc calls
        if name == "handle":
            raise AttributeError("handle is not set")
    
        try:
            return _ffi_node_api.NodeGetAttr(self, name)
        except AttributeError:
>           raise AttributeError(f"{type(self)} has no attribute {name}") from None
E           AttributeError: <class 'tvm.ir.op.Op'> has no attribute name_hint

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/tvm/runtime/object.py:78: AttributeError

Check failure on line 98 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: Found Unsupported operations while lowering from TTForge to TTIR in forward graph
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d76ce3910>
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("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:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: 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 0x7f3d6e633970>, 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:976: RuntimeError

Check failure on line 90 in forge/test/models/onnx/vision/perceiverio/test_perceiverio.py

See this annotation in the file changed.

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

test_perceiverio.test_perceiverio_for_image_classification_pytorch[deepmind/vision-perceiver-conv]

RuntimeError: Unknown type of tensor: <class 'transformers.models.perceiver.modeling_perceiver.PerceiverClassifierOutput'>
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6e4e1120>
variant = 'deepmind/vision-perceiver-conv'

    @pytest.mark.nightly
    @pytest.mark.parametrize("variant", variants)
    def test_perceiverio_for_image_classification_pytorch(record_forge_property, variant):
        if variant != "deepmind/vision-perceiver-conv":
            pytest.skip("Skipping due to the current CI/CD pipeline limitations")
    
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="perceiverio",
            variant=variant,
            task=Task.IMAGE_CLASSIFICATION,
            source=Source.HUGGINGFACE,
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # Sample Image
        pixel_values = get_sample_data(variant)
    
        # Load the model from HuggingFace
        if variant == "deepmind/vision-perceiver-learned":
            framework_model = PerceiverForImageClassificationLearned.from_pretrained(variant)
    
        elif variant == "deepmind/vision-perceiver-conv":
            framework_model = PerceiverForImageClassificationConvProcessing.from_pretrained(variant)
    
        elif variant == "deepmind/vision-perceiver-fourier":
            framework_model = PerceiverForImageClassificationFourier.from_pretrained(variant)
    
        else:
            logger.info(f"The model {variant} is not supported")
    
        framework_model.eval()
    
        inputs = [pixel_values]
    
        # 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/perceiverio/test_perceiverio.py:90: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/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:1145: in to_pt_tensors
    pytorch_tensors.append(to_pt_tensor(t))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

t = PerceiverClassifierOutput(loss=None, logits=tensor([[-1.11858e+00,  5.54125e-02,  8.96908e-02, -3.91983e-01,  1.12919e...2, -4.16579e-01, -4.41800e-01]], grad_fn=<SliceBackward0>), hidden_states=None, attentions=None, cross_attentions=None)

    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 'transformers.models.perceiver.modeling_perceiver.PerceiverClassifierOutput'>

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

Check failure on line 48 in forge/test/models/pytorch/vision/ssd300_resnet50/test_ssd300_resnet50.py

See this annotation in the file changed.

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

test_ssd300_resnet50.test_pytorch_ssd300_resnet50

RuntimeError: Failed to run MLIR compiler pass pipeline.
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6e7963b0>

    @pytest.mark.nightly
    def test_pytorch_ssd300_resnet50(record_forge_property):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH, model="ssd300_resnet50", source=Source.TORCH_HUB, task=Task.IMAGE_CLASSIFICATION
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        # STEP 2 : prepare model
        framework_model = torch.hub.load("NVIDIA/DeepLearningExamples:torchhub", "nvidia_ssd", pretrained=False)
        url = "https://api.ngc.nvidia.com/v2/models/nvidia/ssd_pyt_ckpt_amp/versions/19.09.0/files/nvidia_ssdpyt_fp16_190826.pt"
        checkpoint_path = "nvidia_ssdpyt_fp16_190826.pt"
    
        response = requests.get(url)
        with open(checkpoint_path, "wb") as f:
            f.write(response.content)
    
        checkpoint = torch.load(checkpoint_path, map_location=torch.device("cpu"))
        framework_model.load_state_dict(checkpoint["model"])
        framework_model.eval()
    
        # STEP 3 : prepare input
        img = "http://images.cocodataset.org/val2017/000000397133.jpg"
        HWC = prepare_input(img)
        CHW = np.swapaxes(np.swapaxes(HWC, 0, 2), 1, 2)
        batch = np.expand_dims(CHW, axis=0)
        input_batch = torch.from_numpy(batch).float()
        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/ssd300_resnet50/test_ssd300_resnet50.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_ssd300_resnet50_base_img_cls_torchhub], graph_name='pt_ssd300_resnet50_base_img_cls_...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f3d7dd1c230>, 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:976: RuntimeError

Check failure on line 77 in forge/test/models/pytorch/vision/swin/test_swin.py

See this annotation in the file changed.

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

test_swin.test_swin_v2_tiny_4_256_hf_pytorch[microsoft/swinv2-tiny-patch4-window8-256]

AssertionError: Data mismatch on output 0 between framework and Forge codegen
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6e1ace50>
variant = 'microsoft/swinv2-tiny-patch4-window8-256'

    @pytest.mark.nightly
    @pytest.mark.skip_model_analysis
    @pytest.mark.parametrize("variant", ["microsoft/swinv2-tiny-patch4-window8-256"])
    def test_swin_v2_tiny_4_256_hf_pytorch(record_forge_property, variant):
        # Build Module Name
        module_name = build_module_name(
            framework=Framework.PYTORCH,
            model="swin",
            variant=variant,
            source=Source.HUGGINGFACE,
            task=Task.IMAGE_CLASSIFICATION,
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        feature_extractor = ViTImageProcessor.from_pretrained(variant)
        framework_model = Swinv2Model.from_pretrained(variant)
    
        url = "http://images.cocodataset.org/val2017/000000039769.jpg"
        inputs = load_image(url, feature_extractor)
    
        # Forge compile framework model
>       compiled_model = forge.compile(framework_model, sample_inputs=inputs, module_name=module_name)

forge/test/models/pytorch/vision/swin/test_swin.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: 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:678: in generate_initial_graph
    module, module_inputs = convert_to_forge_module(
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:1021: 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:2140: in generate_forge_module
    verify_framework_vs_forge_codegen(framework_outputs, forge_outputs, verify_cfg=verify_cfg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

frame_outputs = [tensor([[[ 0.16559, -0.19728, -0.95477,  ..., -0.30100,  0.03800,  0.19307],
         [ 1.29882,  0.18637, -1.01701, ...61e-02,  5.80386e-01, -2.40808e-02, -8.48633e-01, -3.12143e-01,  1.05894e+00,  9.82386e-02]], grad_fn=<ViewBackward0>)]
forge_outputs = (Forge Tensor: tensor([[[ 6.75330e-01,  1.34220e+00,  1.81450e+00,  ..., -2.06357e+00,  5.81979e+00, -1.65330e+00],
  ...5.02975e-02, -1.30091e+00, -4.25502e-01,  1.27871e+00,  8.32945e-03]], grad_fn=<SqueezeBackward1>), DataFormat.Float32)
verify_cfg = DepricatedVerifyConfig(graph_name='graph', enabled=False, intermediates=False, rtol={torch.float32: None, torch.float1...ent_checking=True, enable_parameter_gradient_checking=True, _input_gradient_queue=None, _parameter_gradient_queue=None)

    def verify_framework_vs_forge_codegen(frame_outputs, forge_outputs, verify_cfg):
        from forge.verify.compare import compare_tensor_to_golden
    
        test_pass = True
        for i, (golden, output) in enumerate(zip(frame_outputs, forge_outputs)):
            test_pass &= compare_tensor_to_golden(
                f"Framework vs. Forge codegen output {i}", golden, output.value(), is_forge=False, verify_cfg=verify_cfg
            )
    
>           assert test_pass, f"Data mismatch on output {i} between framework and Forge codegen"
E           AssertionError: Data mismatch on output 0 between framework and Forge codegen

/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/tvm_to_python.py:1987: AssertionError

Check failure on line 95 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_640x640[yolov5s]

RuntimeError: Found Unsupported operations while lowering from TTForge to TTIR in forward graph
Raw output
record_forge_property = <function record_property.<locals>.append_property at 0x7f3d6d55b2e0>
size = 's'

    @pytest.mark.nightly
    @pytest.mark.parametrize("size", size, ids=["yolov5" + s for s in size])
    def test_yolov5_640x640(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="640x640",
        )
    
        # Record Forge Property
        record_forge_property("model_name", module_name)
    
        framework_model, inputs, _ = generate_model_yoloV5I640_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:95: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:253: in compile_main
    return forge_compile_from_context(compile_context)
/opt/ttforge-toolchain/venv/lib/python3.10/site-packages/forge/compile.py:295: in forge_compile_from_context
    next_stage = stage_to_func[current_stage](context)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = CompileContext(modules=[Module pt_yolo_v5_yolov5s_imgcls_torchhub_640x640], graph_name='pt_yolo_v5_yolov5s_imgcls_torc...cles_offset=0, forge_module=<forge._C.ForgeGraphModule object at 0x7f3aeb62abf0>, 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:976: RuntimeError