Skip to content

Commit e0e9e0c

Browse files
committed
Iterate on llama user guide.
1 parent fecc081 commit e0e9e0c

File tree

3 files changed

+42
-25
lines changed

3 files changed

+42
-25
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ wheelhouse
3333
# Local-only config options
3434
version_local.json
3535

36-
#Model artifacts
36+
# Model artifacts
3737
*.pt
3838
*.safetensors
3939
*.gguf
4040
*.vmfb
4141
genfiles/
42+
export/
4243
*.zip
4344
tmp/
4445

docs/shortfin/llm/user/e2e_llama8b_mi300x.md

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,24 @@ source .venv/bin/activate
2424

2525
## Install stable shark-ai packages
2626

27-
<!-- TODO: Add `sharktank` to `shark-ai` meta package -->
27+
First install a torch version that fulfills your needs:
2828

2929
```bash
30-
pip install shark-ai[apps] sharktank
30+
# Fast installation of torch with just CPU support.
31+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
3132
```
3233

33-
### Nightly packages
34+
For other options, see https://pytorch.org/get-started/locally/.
3435

35-
To install nightly packages:
36-
37-
<!-- TODO: Add `sharktank` to `shark-ai` meta package -->
36+
Next install shark-ai:
3837

3938
```bash
40-
pip install shark-ai[apps] sharktank \
41-
--pre --find-links https://github.com/nod-ai/shark-ai/releases/expanded_assets/dev-wheels
39+
pip install shark-ai[apps]
4240
```
4341

44-
See also the
45-
[instructions here](https://github.com/nod-ai/shark-ai/blob/main/docs/nightly_releases.md).
42+
> [!TIP]
43+
> To switch from the stable release channel to the nightly release channel,
44+
> see [`nightly_releases.md`](../../../nightly_releases.md).
4645
4746
### Define a directory for export files
4847

@@ -192,25 +191,41 @@ cat shortfin_llm_server.log
192191
[2024-10-24 15:40:27.444] [info] [server.py:214] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
193192
```
194193

195-
## Verify server
194+
## Test the server
196195

197-
We can now verify our LLM server by sending a simple request:
196+
We can now test our LLM server.
198197

199-
### Open python shell
198+
First let's confirm that it is running:
200199

201200
```bash
202-
python
201+
curl -i http://localhost:8000/health
202+
203+
# HTTP/1.1 200 OK
204+
# date: Thu, 19 Dec 2024 19:40:43 GMT
205+
# server: uvicorn
206+
# content-length: 0
203207
```
204208

205-
### Send request
209+
Next, let's send a generation request:
206210

207-
```python
208-
import requests
211+
```bash
212+
curl http://localhost:8000/generate \
213+
-H "Content-Type: application/json" \
214+
-d '{
215+
"text": "Name the capital of the United States.",
216+
"sampling_params": {"max_completion_tokens": 50}
217+
}'
218+
```
219+
220+
### Send requests from Python
209221

222+
You can also send HTTP requests from Python like so:
223+
224+
```python
210225
import os
226+
import requests
211227

212228
port = 8000 # Change if running on a different port
213-
214229
generate_url = f"http://localhost:{port}/generate"
215230

216231
def generation_request():
@@ -225,16 +240,16 @@ def generation_request():
225240
generation_request()
226241
```
227242

228-
After you receive the request, you can exit the python shell:
243+
## Cleanup
244+
245+
When done, you can stop the shortfin_llm_server by killing the process:
229246

230247
```bash
231-
quit()
248+
kill -9 $shortfin_process
232249
```
233250

234-
## Cleanup
235-
236-
When done, you can kill the shortfin_llm_server by killing the process:
251+
If you want to find the process again:
237252

238253
```bash
239-
kill -9 $shortfin_process
254+
ps -f | grep shortfin
240255
```

docs/user_guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Officially we support Python versions: 3.11, 3.12, 3.13
1717
The rest of this guide assumes you are using Python 3.11.
1818

1919
### Install Python
20+
2021
To install Python 3.11 on Ubuntu:
2122

2223
```bash

0 commit comments

Comments
 (0)