| 1 | # Llama CLI Reference |
| 2 | |
| 3 | The `llama` CLI tool helps you setup and use the Llama toolchain & agentic systems. It should be available on your path after installing the `llama-stack` package. |
| 4 | |
| 5 | ### Subcommands |
| 6 | 1. `download`: `llama` cli tools supports downloading the model from Meta or Hugging Face. |
| 7 | 2. `model`: Lists available models and their properties. |
| 8 | 3. `stack`: Allows you to build and run a Llama Stack server. You can read more about this [here](/docs/cli_reference.md#step-3-building-configuring-and-running-llama-stack-servers). |
| 9 | |
| 10 | ### Sample Usage |
| 11 | |
| 12 | ``` |
| 13 | llama --help |
| 14 | ``` |
| 15 | <pre style="font-family: monospace;"> |
| 16 | usage: llama [-h] {download,model,stack} ... |
| 17 | |
| 18 | Welcome to the Llama CLI |
| 19 | |
| 20 | options: |
| 21 | -h, --help show this help message and exit |
| 22 | |
| 23 | subcommands: |
| 24 | {download,model,stack} |
| 25 | </pre> |
| 26 | |
| 27 | ## Step 1. Get the models |
| 28 | |
| 29 | You first need to have models downloaded locally. |
| 30 | |
| 31 | To download any model you need the **Model Descriptor**. |
| 32 | This can be obtained by running the command |
| 33 | ``` |
| 34 | llama model list |
| 35 | ``` |
| 36 | |
| 37 | You should see a table like this: |
| 38 | |
| 39 | <pre style="font-family: monospace;"> |
| 40 | +----------------------------------+------------------------------------------+----------------+ |
| 41 | | Model Descriptor | Hugging Face Repo | Context Length | |
| 42 | +----------------------------------+------------------------------------------+----------------+ |
| 43 | | Llama3.1-8B | meta-llama/Llama-3.1-8B | 128K | |
| 44 | +----------------------------------+------------------------------------------+----------------+ |
| 45 | | Llama3.1-70B | meta-llama/Llama-3.1-70B | 128K | |
| 46 | +----------------------------------+------------------------------------------+----------------+ |
| 47 | | Llama3.1-405B:bf16-mp8 | meta-llama/Llama-3.1-405B | 128K | |
| 48 | +----------------------------------+------------------------------------------+----------------+ |
| 49 | | Llama3.1-405B | meta-llama/Llama-3.1-405B-FP8 | 128K | |
| 50 | +----------------------------------+------------------------------------------+----------------+ |
| 51 | | Llama3.1-405B:bf16-mp16 | meta-llama/Llama-3.1-405B | 128K | |
| 52 | +----------------------------------+------------------------------------------+----------------+ |
| 53 | | Llama3.1-8B-Instruct | meta-llama/Llama-3.1-8B-Instruct | 128K | |
| 54 | +----------------------------------+------------------------------------------+----------------+ |
| 55 | | Llama3.1-70B-Instruct | meta-llama/Llama-3.1-70B-Instruct | 128K | |
| 56 | +----------------------------------+------------------------------------------+----------------+ |
| 57 | | Llama3.1-405B-Instruct:bf16-mp8 | meta-llama/Llama-3.1-405B-Instruct | 128K | |
| 58 | +----------------------------------+------------------------------------------+----------------+ |
| 59 | | Llama3.1-405B-Instruct | meta-llama/Llama-3.1-405B-Instruct-FP8 | 128K | |
| 60 | +----------------------------------+------------------------------------------+----------------+ |
| 61 | | Llama3.1-405B-Instruct:bf16-mp16 | meta-llama/Llama-3.1-405B-Instruct | 128K | |
| 62 | +----------------------------------+------------------------------------------+----------------+ |
| 63 | | Llama3.2-1B | meta-llama/Llama-3.2-1B | 128K | |
| 64 | +----------------------------------+------------------------------------------+----------------+ |
| 65 | | Llama3.2-3B | meta-llama/Llama-3.2-3B | 128K | |
| 66 | +----------------------------------+------------------------------------------+----------------+ |
| 67 | | Llama3.2-11B-Vision | meta-llama/Llama-3.2-11B-Vision | 128K | |
| 68 | +----------------------------------+------------------------------------------+----------------+ |
| 69 | | Llama3.2-90B-Vision | meta-llama/Llama-3.2-90B-Vision | 128K | |
| 70 | +----------------------------------+------------------------------------------+----------------+ |
| 71 | | Llama3.2-1B-Instruct | meta-llama/Llama-3.2-1B-Instruct | 128K | |
| 72 | +----------------------------------+------------------------------------------+----------------+ |
| 73 | | Llama3.2-3B-Instruct | meta-llama/Llama-3.2-3B-Instruct | 128K | |
| 74 | +----------------------------------+------------------------------------------+----------------+ |
| 75 | | Llama3.2-11B-Vision-Instruct | meta-llama/Llama-3.2-11B-Vision-Instruct | 128K | |
| 76 | +----------------------------------+------------------------------------------+----------------+ |
| 77 | | Llama3.2-90B-Vision-Instruct | meta-llama/Llama-3.2-90B-Vision-Instruct | 128K | |
| 78 | +----------------------------------+------------------------------------------+----------------+ |
| 79 | | Llama-Guard-3-11B-Vision | meta-llama/Llama-Guard-3-11B-Vision | 128K | |
| 80 | +----------------------------------+------------------------------------------+----------------+ |
| 81 | | Llama-Guard-3-1B:int4-mp1 | meta-llama/Llama-Guard-3-1B-INT4 | 128K | |
| 82 | +----------------------------------+------------------------------------------+----------------+ |
| 83 | | Llama-Guard-3-1B | meta-llama/Llama-Guard-3-1B | 128K | |
| 84 | +----------------------------------+------------------------------------------+----------------+ |
| 85 | | Llama-Guard-3-8B | meta-llama/Llama-Guard-3-8B | 128K | |
| 86 | +----------------------------------+------------------------------------------+----------------+ |
| 87 | | Llama-Guard-3-8B:int8-mp1 | meta-llama/Llama-Guard-3-8B-INT8 | 128K | |
| 88 | +----------------------------------+------------------------------------------+----------------+ |
| 89 | | Prompt-Guard-86M | meta-llama/Prompt-Guard-86M | 128K | |
| 90 | +----------------------------------+------------------------------------------+----------------+ |
| 91 | | Llama-Guard-2-8B | meta-llama/Llama-Guard-2-8B | 4K | |
| 92 | +----------------------------------+------------------------------------------+----------------+ |
| 93 | </pre> |
| 94 | |
| 95 | To download models, you can use the llama download command. |
| 96 | |
| 97 | #### Downloading from [Meta](https://llama.meta.com/llama-downloads/) |
| 98 | |
| 99 | Here is an example download command to get the 3B-Instruct/11B-Vision-Instruct model. You will need META_URL which can be obtained from [here](https://llama.meta.com/docs/getting_the_models/meta/) |
| 100 | |
| 101 | Download the required checkpoints using the following commands: |
| 102 | ```bash |
| 103 | # download the 8B model, this can be run on a single GPU |
| 104 | llama download --source meta --model-id Llama3.2-3B-Instruct --meta-url META_URL |
| 105 | |
| 106 | # you can also get the 70B model, this will require 8 GPUs however |
| 107 | llama download --source meta --model-id Llama3.2-11B-Vision-Instruct --meta-url META_URL |
| 108 | |
| 109 | # llama-agents have safety enabled by default. For this, you will need |
| 110 | # safety models -- Llama-Guard and Prompt-Guard |
| 111 | llama download --source meta --model-id Prompt-Guard-86M --meta-url META_URL |
| 112 | llama download --source meta --model-id Llama-Guard-3-8B --meta-url META_URL |
| 113 | ``` |
| 114 | |
| 115 | #### Downloading from [Hugging Face](https://huggingface.co/meta-llama) |
| 116 | |
| 117 | Essentially, the same commands above work, just replace `--source meta` with `--source huggingface`. |
| 118 | |
| 119 | ```bash |
| 120 | llama download --source huggingface --model-id Meta-Llama3.1-8B-Instruct --hf-token <HF_TOKEN> |
| 121 | |
| 122 | llama download --source huggingface --model-id Meta-Llama3.1-70B-Instruct --hf-token <HF_TOKEN> |
| 123 | |
| 124 | llama download --source huggingface --model-id Llama-Guard-3-8B --ignore-patterns *original* |
| 125 | llama download --source huggingface --model-id Prompt-Guard-86M --ignore-patterns *original* |
| 126 | ``` |
| 127 | |
| 128 | **Important:** Set your environment variable `HF_TOKEN` or pass in `--hf-token` to the command to validate your access. You can find your token at [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens). |
| 129 | |
| 130 | > **Tip:** Default for `llama download` is to run with `--ignore-patterns *.safetensors` since we use the `.pth` files in the `original` folder. For Llama Guard and Prompt Guard, however, we need safetensors. Hence, please run with `--ignore-patterns original` so that safetensors are downloaded and `.pth` files are ignored. |
| 131 | |
| 132 | #### Downloading via Ollama |
| 133 | |
| 134 | If you're already using ollama, we also have a supported Llama Stack distribution `local-ollama` and you can continue to use ollama for managing model downloads. |
| 135 | |
| 136 | ``` |
| 137 | ollama pull llama3.1:8b-instruct-fp16 |
| 138 | ollama pull llama3.1:70b-instruct-fp16 |
| 139 | ``` |
| 140 | |
| 141 | > [!NOTE] |
| 142 | > Only the above two models are currently supported by Ollama. |
| 143 | |
| 144 | |
| 145 | ## Step 2: Understand the models |
| 146 | The `llama model` command helps you explore the model’s interface. |
| 147 | |
| 148 | ### 2.1 Subcommands |
| 149 | 1. `download`: Download the model from different sources. (meta, huggingface) |
| 150 | 2. `list`: Lists all the models available for download with hardware requirements to deploy the models. |
| 151 | 3. `prompt-format`: Show llama model message formats. |
| 152 | 4. `describe`: Describes all the properties of the model. |
| 153 | |
| 154 | ### 2.2 Sample Usage |
| 155 | |
| 156 | `llama model <subcommand> <options>` |
| 157 | |
| 158 | ``` |
| 159 | llama model --help |
| 160 | ``` |
| 161 | <pre style="font-family: monospace;"> |
| 162 | usage: llama model [-h] {download,list,prompt-format,describe} ... |
| 163 | |
| 164 | Work with llama models |
| 165 | |
| 166 | options: |
| 167 | -h, --help show this help message and exit |
| 168 | |
| 169 | model_subcommands: |
| 170 | {download,list,prompt-format,describe} |
| 171 | </pre> |
| 172 | |
| 173 | You can use the describe command to know more about a model: |
| 174 | ``` |
| 175 | llama model describe -m Llama3.2-3B-Instruct |
| 176 | ``` |
| 177 | ### 2.3 Describe |
| 178 | |
| 179 | <pre style="font-family: monospace;"> |
| 180 | +-----------------------------+----------------------------------+ |
| 181 | | Model | Llama3.2-3B-Instruct | |
| 182 | +-----------------------------+----------------------------------+ |
| 183 | | Hugging Face ID | meta-llama/Llama-3.2-3B-Instruct | |
| 184 | +-----------------------------+----------------------------------+ |
| 185 | | Description | Llama 3.2 3b instruct model | |
| 186 | +-----------------------------+----------------------------------+ |
| 187 | | Context Length | 128K tokens | |
| 188 | +-----------------------------+----------------------------------+ |
| 189 | | Weights format | bf16 | |
| 190 | +-----------------------------+----------------------------------+ |
| 191 | | Model params.json | { | |
| 192 | | | "dim": 3072, | |
| 193 | | | "n_layers": 28, | |
| 194 | | | "n_heads": 24, | |
| 195 | | | "n_kv_heads": 8, | |
| 196 | | | "vocab_size": 128256, | |
| 197 | | | "ffn_dim_multiplier": 1.0, | |
| 198 | | | "multiple_of": 256, | |
| 199 | | | "norm_eps": 1e-05, | |
| 200 | | | "rope_theta": 500000.0, | |
| 201 | | | "use_scaled_rope": true | |
| 202 | | | } | |
| 203 | +-----------------------------+----------------------------------+ |
| 204 | | Recommended sampling params | { | |
| 205 | | | "strategy": "top_p", | |
| 206 | | | "temperature": 1.0, | |
| 207 | | | "top_p": 0.9, | |
| 208 | | | "top_k": 0 | |
| 209 | | | } | |
| 210 | +-----------------------------+----------------------------------+ |
| 211 | </pre> |
| 212 | ### 2.4 Prompt Format |
| 213 | You can even run `llama model prompt-format` see all of the templates and their tokens: |
| 214 | |
| 215 | ``` |
| 216 | llama model prompt-format -m Llama3.2-3B-Instruct |
| 217 | ``` |
| 218 | <p align="center"> |
| 219 | <img width="719" alt="image" src="https://github.com/user-attachments/assets/c5332026-8c0b-4edc-b438-ec60cd7ca554"> |
| 220 | </p> |
| 221 | |
| 222 | |
| 223 | You will be shown a Markdown formatted description of the model interface and how prompts / messages are formatted for various scenarios. |
| 224 | |
| 225 | **NOTE**: Outputs in terminal are color printed to show special tokens. |
| 226 | |
| 227 | |
| 228 | ## Step 3: Building, and Configuring Llama Stack Distributions |
| 229 | |
| 230 | - Please see our [Getting Started](getting_started.md) guide for more details on how to build and start a Llama Stack distribution. |
| 231 | |
| 232 | ### Step 3.1 Build |
| 233 | In the following steps, imagine we'll be working with a `Meta-Llama3.1-8B-Instruct` model. We will name our build `8b-instruct` to help us remember the config. We will start build our distribution (in the form of a Conda environment, or Docker image). In this step, we will specify: |
| 234 | - `name`: the name for our distribution (e.g. `8b-instruct`) |
| 235 | - `image_type`: our build image type (`conda | docker`) |
| 236 | - `distribution_spec`: our distribution specs for specifying API providers |
| 237 | - `description`: a short description of the configurations for the distribution |
| 238 | - `providers`: specifies the underlying implementation for serving each API endpoint |
| 239 | - `image_type`: `conda` | `docker` to specify whether to build the distribution in the form of Docker image or Conda environment. |
| 240 | |
| 241 | |
| 242 | At the end of build command, we will generate `<name>-build.yaml` file storing the build configurations. |
| 243 | |
| 244 | After this step is complete, a file named `<name>-build.yaml` will be generated and saved at the output file path specified at the end of the command. |
| 245 | |
| 246 | #### Building from scratch |
| 247 | - For a new user, we could start off with running `llama stack build` which will allow you to a interactively enter wizard where you will be prompted to enter build configurations. |
| 248 | ``` |
| 249 | llama stack build |
| 250 | ``` |
| 251 | |
| 252 | Running the command above will allow you to fill in the configuration to build your Llama Stack distribution, you will see the following outputs. |
| 253 | |
| 254 | ``` |
| 255 | > Enter an unique name for identifying your Llama Stack build distribution (e.g. my-local-stack): my-local-llama-stack |
| 256 | > Enter the image type you want your distribution to be built with (docker or conda): conda |
| 257 | |
| 258 | Llama Stack is composed of several APIs working together. Let's configure the providers (implementations) you want to use for these APIs. |
| 259 | > Enter the API provider for the inference API: (default=meta-reference): meta-reference |
| 260 | > Enter the API provider for the safety API: (default=meta-reference): meta-reference |
| 261 | > Enter the API provider for the agents API: (default=meta-reference): meta-reference |
| 262 | > Enter the API provider for the memory API: (default=meta-reference): meta-reference |
| 263 | > Enter the API provider for the telemetry API: (default=meta-reference): meta-reference |
| 264 | |
| 265 | > (Optional) Enter a short description for your Llama Stack distribution: |
| 266 | |
| 267 | Build spec configuration saved at ~/.conda/envs/llamastack-my-local-llama-stack/my-local-llama-stack-build.yaml |
| 268 | ``` |
| 269 | |
| 270 | #### Building from templates |
| 271 | - To build from alternative API providers, we provide distribution templates for users to get started building a distribution backed by different providers. |
| 272 | |
| 273 | The following command will allow you to see the available templates and their corresponding providers. |
| 274 | ``` |
| 275 | llama stack build --list-templates |
| 276 | ``` |
| 277 | |
| 278 |  |
| 279 | |
| 280 | You may then pick a template to build your distribution with providers fitted to your liking. |
| 281 | |
| 282 | ``` |
| 283 | llama stack build --template local-tgi --name my-tgi-stack |
| 284 | ``` |
| 285 | |
| 286 | ``` |
| 287 | $ llama stack build --template local-tgi --name my-tgi-stack |
| 288 | ... |
| 289 | ... |
| 290 | Build spec configuration saved at ~/.conda/envs/llamastack-my-tgi-stack/my-tgi-stack-build.yaml |
| 291 | You may now run `llama stack configure my-tgi-stack` or `llama stack configure ~/.conda/envs/llamastack-my-tgi-stack/my-tgi-stack-build.yaml` |
| 292 | ``` |
| 293 | |
| 294 | #### Building from config file |
| 295 | - In addition to templates, you may customize the build to your liking through editing config files and build from config files with the following command. |
| 296 | |
| 297 | - The config file will be of contents like the ones in `llama_stack/distributions/templates/`. |
| 298 | |
| 299 | ``` |
| 300 | $ cat llama_stack/distribution/templates/local-ollama-build.yaml |
| 301 | |
| 302 | name: local-ollama |
| 303 | distribution_spec: |
| 304 | description: Like local, but use ollama for running LLM inference |
| 305 | providers: |
| 306 | inference: remote::ollama |
| 307 | memory: meta-reference |
| 308 | safety: meta-reference |
| 309 | agents: meta-reference |
| 310 | telemetry: meta-reference |
| 311 | image_type: conda |
| 312 | ``` |
| 313 | |
| 314 | ``` |
| 315 | llama stack build --config llama_stack/distribution/templates/local-ollama-build.yaml |
| 316 | ``` |
| 317 | |
| 318 | #### How to build distribution with Docker image |
| 319 | |
| 320 | To build a docker image, you may start off from a template and use the `--image-type docker` flag to specify `docker` as the build image type. |
| 321 | |
| 322 | ``` |
| 323 | llama stack build --template local --image-type docker --name docker-0 |
| 324 | ``` |
| 325 | |
| 326 | Alternatively, you may use a config file and set `image_type` to `docker` in our `<name>-build.yaml` file, and run `llama stack build <name>-build.yaml`. The `<name>-build.yaml` will be of contents like: |
| 327 | |
| 328 | ``` |
| 329 | name: local-docker-example |
| 330 | distribution_spec: |
| 331 | description: Use code from `llama_stack` itself to serve all llama stack APIs |
| 332 | docker_image: null |
| 333 | providers: |
| 334 | inference: meta-reference |
| 335 | memory: meta-reference-faiss |
| 336 | safety: meta-reference |
| 337 | agentic_system: meta-reference |
| 338 | telemetry: console |
| 339 | image_type: docker |
| 340 | ``` |
| 341 | |
| 342 | The following command allows you to build a Docker image with the name `<name>` |
| 343 | ``` |
| 344 | llama stack build --config <name>-build.yaml |
| 345 | |
| 346 | Dockerfile created successfully in /tmp/tmp.I0ifS2c46A/DockerfileFROM python:3.10-slim |
| 347 | WORKDIR /app |
| 348 | ... |
| 349 | ... |
| 350 | You can run it with: podman run -p 8000:8000 llamastack-docker-local |
| 351 | Build spec configuration saved at ~/.llama/distributions/docker/docker-local-build.yaml |
| 352 | ``` |
| 353 | |
| 354 | |
| 355 | ### Step 3.2 Configure |
| 356 | After our distribution is built (either in form of docker or conda environment), we will run the following command to |
| 357 | ``` |
| 358 | llama stack configure [ <name> | <docker-image-name> | <path/to/name.build.yaml>] |
| 359 | ``` |
| 360 | - For `conda` environments: <path/to/name.build.yaml> would be the generated build spec saved from Step 1. |
| 361 | - For `docker` images downloaded from Dockerhub, you could also use <docker-image-name> as the argument. |
| 362 | - Run `docker images` to check list of available images on your machine. |
| 363 | |
| 364 | ``` |
| 365 | $ llama stack configure ~/.llama/distributions/conda/8b-instruct-build.yaml |
| 366 | |
| 367 | Configuring API: inference (meta-reference) |
| 368 | Enter value for model (existing: Meta-Llama3.1-8B-Instruct) (required): |
| 369 | Enter value for quantization (optional): |
| 370 | Enter value for torch_seed (optional): |
| 371 | Enter value for max_seq_len (existing: 4096) (required): |
| 372 | Enter value for max_batch_size (existing: 1) (required): |
| 373 | |
| 374 | Configuring API: memory (meta-reference-faiss) |
| 375 | |
| 376 | Configuring API: safety (meta-reference) |
| 377 | Do you want to configure llama_guard_shield? (y/n): y |
| 378 | Entering sub-configuration for llama_guard_shield: |
| 379 | Enter value for model (default: Llama-Guard-3-8B) (required): |
| 380 | Enter value for excluded_categories (default: []) (required): |
| 381 | Enter value for disable_input_check (default: False) (required): |
| 382 | Enter value for disable_output_check (default: False) (required): |
| 383 | Do you want to configure prompt_guard_shield? (y/n): y |
| 384 | Entering sub-configuration for prompt_guard_shield: |
| 385 | Enter value for model (default: Prompt-Guard-86M) (required): |
| 386 | |
| 387 | Configuring API: agentic_system (meta-reference) |
| 388 | Enter value for brave_search_api_key (optional): |
| 389 | Enter value for bing_search_api_key (optional): |
| 390 | Enter value for wolfram_api_key (optional): |
| 391 | |
| 392 | Configuring API: telemetry (console) |
| 393 | |
| 394 | YAML configuration has been written to ~/.llama/builds/conda/8b-instruct-run.yaml |
| 395 | ``` |
| 396 | |
| 397 | After this step is successful, you should be able to find a run configuration spec in `~/.llama/builds/conda/8b-instruct-run.yaml` with the following contents. You may edit this file to change the settings. |
| 398 | |
| 399 | As you can see, we did basic configuration above and configured: |
| 400 | - inference to run on model `Meta-Llama3.1-8B-Instruct` (obtained from `llama model list`) |
| 401 | - Llama Guard safety shield with model `Llama-Guard-3-8B` |
| 402 | - Prompt Guard safety shield with model `Prompt-Guard-86M` |
| 403 | |
| 404 | For how these configurations are stored as yaml, checkout the file printed at the end of the configuration. |
| 405 | |
| 406 | Note that all configurations as well as models are stored in `~/.llama` |
| 407 | |
| 408 | |
| 409 | ### Step 3.3 Run |
| 410 | Now, let's start the Llama Stack Distribution Server. You will need the YAML configuration file which was written out at the end by the `llama stack configure` step. |
| 411 | |
| 412 | ``` |
| 413 | llama stack run ~/.llama/builds/conda/8b-instruct-run.yaml |
| 414 | ``` |
| 415 | |
| 416 | You should see the Llama Stack server start and print the APIs that it is supporting |
| 417 | |
| 418 | ``` |
| 419 | $ llama stack run ~/.llama/builds/local/conda/8b-instruct.yaml |
| 420 | |
| 421 | > initializing model parallel with size 1 |
| 422 | > initializing ddp with size 1 |
| 423 | > initializing pipeline with size 1 |
| 424 | Loaded in 19.28 seconds |
| 425 | NCCL version 2.20.5+cuda12.4 |
| 426 | Finished model load YES READY |
| 427 | Serving POST /inference/batch_chat_completion |
| 428 | Serving POST /inference/batch_completion |
| 429 | Serving POST /inference/chat_completion |
| 430 | Serving POST /inference/completion |
| 431 | Serving POST /safety/run_shield |
| 432 | Serving POST /agentic_system/memory_bank/attach |
| 433 | Serving POST /agentic_system/create |
| 434 | Serving POST /agentic_system/session/create |
| 435 | Serving POST /agentic_system/turn/create |
| 436 | Serving POST /agentic_system/delete |
| 437 | Serving POST /agentic_system/session/delete |
| 438 | Serving POST /agentic_system/memory_bank/detach |
| 439 | Serving POST /agentic_system/session/get |
| 440 | Serving POST /agentic_system/step/get |
| 441 | Serving POST /agentic_system/turn/get |
| 442 | Listening on :::5000 |
| 443 | INFO: Started server process [453333] |
| 444 | INFO: Waiting for application startup. |
| 445 | INFO: Application startup complete. |
| 446 | INFO: Uvicorn running on http://[::]:5000 (Press CTRL+C to quit) |
| 447 | ``` |
| 448 | |
| 449 | > [!NOTE] |
| 450 | > Configuration is in `~/.llama/builds/local/conda/8b-instruct-run.yaml`. Feel free to increase `max_seq_len`. |
| 451 | |
| 452 | > [!IMPORTANT] |
| 453 | > The "local" distribution inference server currently only supports CUDA. It will not work on Apple Silicon machines. |
| 454 | |
| 455 | > [!TIP] |
| 456 | > You might need to use the flag `--disable-ipv6` to Disable IPv6 support |
| 457 | |
| 458 | This server is running a Llama model locally. |
| 459 | |
| 460 | ### Step 3.4 Test with Client |
| 461 | Once the server is setup, we can test it with a client to see the example outputs. |
| 462 | ``` |
| 463 | cd /path/to/llama-stack |
| 464 | conda activate <env> # any environment containing the llama-stack pip package will work |
| 465 | |
| 466 | python -m llama_stack.apis.inference.client localhost 5000 |
| 467 | ``` |
| 468 | |
| 469 | This will run the chat completion client and query the distribution’s /inference/chat_completion API. |
| 470 | |
| 471 | Here is an example output: |
| 472 | ``` |
| 473 | User>hello world, write me a 2 sentence poem about the moon |
| 474 | Assistant> Here's a 2-sentence poem about the moon: |
| 475 | |
| 476 | The moon glows softly in the midnight sky, |
| 477 | A beacon of wonder, as it passes by. |
| 478 | ``` |
| 479 | |
| 480 | Similarly you can test safety (if you configured llama-guard and/or prompt-guard shields) by: |
| 481 | |
| 482 | ``` |
| 483 | python -m llama_stack.apis.safety.client localhost 5000 |
| 484 | ``` |
| 485 | |
| 486 | You can find more example scripts with client SDKs to talk with the Llama Stack server in our [llama-stack-apps](https://github.com/meta-llama/llama-stack-apps/tree/main/examples) repo. |