Skip to content

Commit

Permalink
Import tt-metal model via pythonpath instead of symlink
Browse files Browse the repository at this point in the history
Signed-off-by: Salar Hosseini <[email protected]>
  • Loading branch information
skhorasganiTT committed Oct 29, 2024
1 parent fb458d0 commit bc896fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/offline_inference_tt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from vllm.inputs.data import TokensPrompt
from vllm.engine.multiprocessing.client import MQLLMEngineClient

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from tt_metal.models.demos.t3000.llama2_70b.tt.llama_generation import TtLlamaModelForGeneration
# Import and register model from tt-metal
from models.demos.t3000.llama2_70b.tt.llama_generation import TtLlamaModelForGeneration
ModelRegistry.register_model("TTLlamaForCausalLM", TtLlamaModelForGeneration)


Expand Down
4 changes: 2 additions & 2 deletions examples/server_example_tt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from vllm import ModelRegistry

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from tt_metal.models.demos.t3000.llama2_70b.tt.llama_generation import TtLlamaModelForGeneration
# Import and register model from tt-metal
from models.demos.t3000.llama2_70b.tt.llama_generation import TtLlamaModelForGeneration
ModelRegistry.register_model("TTLlamaForCausalLM", TtLlamaModelForGeneration)


Expand Down
6 changes: 1 addition & 5 deletions tt_metal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ To run Meta-Llama-3.1, it is required to have access to the model on Hugging Fac

## Preparing the tt-metal models

1. Create a symbolic link to the tt-metal models folder inside vLLM:
```sh
cd tt_metal
ln -s <path/to/tt-metal>/models ./models
```
1. Ensure that `$PYTHONPATH` contains the path to tt-metal (should already have been done when installing tt-metal)
2. For the desired model, follow the setup instructions (if any) for the corresponding tt-metal demo. E.g. For Llama-3.1-70B, follow the [demo instructions](https://github.com/tenstorrent/tt-metal/tree/main/models/demos/t3000/llama3_70b) for preparing the weights and environment variables.

## Running the offline inference example
Expand Down

0 comments on commit bc896fa

Please sign in to comment.