diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f647b8e71 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/tt_forge_models"] + path = third_party/tt_forge_models + url = https://github.com/tenstorrent/tt-forge-models.git diff --git a/demos/tt-forge-fe/cnn/densenet_demo.py b/demos/tt-forge-fe/cnn/densenet_demo.py new file mode 100644 index 000000000..1f765a4b6 --- /dev/null +++ b/demos/tt-forge-fe/cnn/densenet_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Densenet Demo Script + +import forge +from ....third_party.tt_forge_models.densenet.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/efficientnet_demo.py b/demos/tt-forge-fe/cnn/efficientnet_demo.py new file mode 100644 index 000000000..8f0fa213e --- /dev/null +++ b/demos/tt-forge-fe/cnn/efficientnet_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Efficientnet Demo Script + +import forge +from third_party.tt_forge_models.efficientnet.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/ghostnet_demo.py b/demos/tt-forge-fe/cnn/ghostnet_demo.py new file mode 100644 index 000000000..fd06f4dfb --- /dev/null +++ b/demos/tt-forge-fe/cnn/ghostnet_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Ghostnet Demo Script + +import forge +from ....third_party.tt_forge_models.ghostnet.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/regnet_demo.py b/demos/tt-forge-fe/cnn/regnet_demo.py new file mode 100644 index 000000000..a429dcb12 --- /dev/null +++ b/demos/tt-forge-fe/cnn/regnet_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Regnet Demo Script + +import forge +from ....third_party.tt_forge_models.regnet.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/resnext_demo.py b/demos/tt-forge-fe/cnn/resnext_demo.py new file mode 100644 index 000000000..71aa8eada --- /dev/null +++ b/demos/tt-forge-fe/cnn/resnext_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Resnext Demo Script + +import forge +from ....third_party.tt_forge_models.resnext.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/swin_demo.py b/demos/tt-forge-fe/cnn/swin_demo.py new file mode 100644 index 000000000..24caf5206 --- /dev/null +++ b/demos/tt-forge-fe/cnn/swin_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Swin Demo Script + +import forge +from ....third_party.tt_forge_models.swin.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/vgg_demo.py b/demos/tt-forge-fe/cnn/vgg_demo.py new file mode 100644 index 000000000..69fda018e --- /dev/null +++ b/demos/tt-forge-fe/cnn/vgg_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Vgg Demo Script + +import forge +from ....third_party.tt_forge_models.vgg.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/wideresnet_demo.py b/demos/tt-forge-fe/cnn/wideresnet_demo.py new file mode 100644 index 000000000..43c68a545 --- /dev/null +++ b/demos/tt-forge-fe/cnn/wideresnet_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Wideresnet Demo Script + +import forge +from ....third_party.tt_forge_models.wide_resnet.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/cnn/xception_demo.py b/demos/tt-forge-fe/cnn/xception_demo.py new file mode 100644 index 000000000..6bd3fedf4 --- /dev/null +++ b/demos/tt-forge-fe/cnn/xception_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Xception Demo Script + +import forge +from ....third_party.tt_forge_models.xception.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) + +# Post-process the output +# ModelLoader.print_cls_results(output) diff --git a/demos/tt-forge-fe/nlp/dpr_demo.py b/demos/tt-forge-fe/nlp/dpr_demo.py new file mode 100644 index 000000000..00120087a --- /dev/null +++ b/demos/tt-forge-fe/nlp/dpr_demo.py @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# DPR Demo Script + +import forge +from ....third_party.tt_forge_models.dpr.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +input_tokens = ModelLoader.load_inputs() + +inputs = [input_tokens["input_ids"], input_tokens["attention_mask"], input_tokens["token_type_ids"]] + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=inputs) + +# Run inference on Tenstorrent device +output = compiled_model(*inputs) diff --git a/demos/tt-forge-fe/nlp/mamba_demo.py b/demos/tt-forge-fe/nlp/mamba_demo.py new file mode 100644 index 000000000..a3fe857fd --- /dev/null +++ b/demos/tt-forge-fe/nlp/mamba_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# Mamba Demo Script + +import forge +from ....third_party.tt_forge_models.mamba.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +input_tokens = ModelLoader.load_inputs() + +# prepare input +inputs = [input_tokens["input_ids"]] + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=inputs) + +# Run inference on Tenstorrent device +output = compiled_model(*inputs) diff --git a/demos/tt-forge-fe/nlp/roberta_demo.py b/demos/tt-forge-fe/nlp/roberta_demo.py new file mode 100644 index 000000000..a4c21114b --- /dev/null +++ b/demos/tt-forge-fe/nlp/roberta_demo.py @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# RoBERTa Demo Script + +import forge +from ....third_party.tt_forge_models.roberta.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) diff --git a/demos/tt-forge-fe/nlp/squeezebert_demo.py b/demos/tt-forge-fe/nlp/squeezebert_demo.py new file mode 100644 index 000000000..d284ea143 --- /dev/null +++ b/demos/tt-forge-fe/nlp/squeezebert_demo.py @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# SqueezeBERT Demo Script + +import forge +from ....third_party.tt_forge_models.squeezebert.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +inputs = ModelLoader.load_inputs() + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=[inputs]) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) diff --git a/demos/tt-forge-fe/nlp/xglm_demo.py b/demos/tt-forge-fe/nlp/xglm_demo.py new file mode 100644 index 000000000..68fbb2480 --- /dev/null +++ b/demos/tt-forge-fe/nlp/xglm_demo.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2025 Tenstorrent AI ULC +# SPDX-License-Identifier: Apache-2.0 + +# XGLM Demo Script + +import forge +from ....third_party.tt_forge_models.xglm.pytorch import ModelLoader + +# Load model and input +model = ModelLoader.load_model() +input_tokens = ModelLoader.load_inputs() + +# Prepare input +inputs = [input_tokens["input_ids"], input_tokens["attention_mask"]] + +# Compile the model using Forge +compiled_model = forge.compile(model, sample_inputs=inputs) + +# Run inference on Tenstorrent device +output = compiled_model(inputs) diff --git a/third_party/__init__.py b/third_party/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/third_party/tt_forge_models b/third_party/tt_forge_models new file mode 160000 index 000000000..3b8b567bb --- /dev/null +++ b/third_party/tt_forge_models @@ -0,0 +1 @@ +Subproject commit 3b8b567bb82f8dd573adc6d6ca819fa3d32b7c62