Skip to content

Commit 9222bec

Browse files
authored
How To Updates / Model Used Switched / Removed "docker-compose" (RIP) (#1417)
* Update _index.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-model.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <[email protected]> * Update _index.en.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-model.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-cpu.md Signed-off-by: lunamidori5 <[email protected]> * Update _index.en.md Signed-off-by: lunamidori5 <[email protected]> * Update easy-setup-docker-gpu.md Signed-off-by: lunamidori5 <[email protected]> --------- Signed-off-by: lunamidori5 <[email protected]>
1 parent 4a965e1 commit 9222bec

File tree

5 files changed

+71
-60
lines changed

5 files changed

+71
-60
lines changed

docs/content/getting_started/_index.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ curl http://localhost:8080/v1/completions -H "Content-Type: application/json" -d
8888
}'
8989
```
9090

91-
Note: If you are on Windows, please run ``docker-compose`` not ``docker compose`` and make sure the project is in the Linux Filesystem, otherwise loading models might be slow. For more Info: [Microsoft Docs](https://learn.microsoft.com/en-us/windows/wsl/filesystems)
91+
Note: If you are on Windows, please make sure the project is on the Linux Filesystem, otherwise loading models might be slow. For more Info: [Microsoft Docs](https://learn.microsoft.com/en-us/windows/wsl/filesystems)
9292

9393
{{% /tab %}}
9494

docs/content/howtos/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ This section includes LocalAI end-to-end examples, tutorial and how-tos curated
1111
- [Setup LocalAI with Docker on CPU]({{%relref "howtos/easy-setup-docker-cpu" %}})
1212
- [Setup LocalAI with Docker With CUDA]({{%relref "howtos/easy-setup-docker-gpu" %}})
1313
- [Seting up a Model]({{%relref "howtos/easy-model" %}})
14-
- [Making requests to LocalAI]({{%relref "howtos/easy-request" %}})
14+
- [Making Text / LLM requests to LocalAI]({{%relref "howtos/easy-request" %}})
15+
- [Making Photo / SD requests to LocalAI]({{%relref "howtos/easy-setup-sd" %}})
1516

1617
## Programs and Demos
1718

docs/content/howtos/easy-model.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,52 @@ title = "Easy Model Setup"
55
weight = 2
66
+++
77

8-
Lets Learn how to setup a model, for this ``How To`` we are going to use the ``Luna-Ai`` model (Yes I know haha - ``Luna Midori`` making a how to using the ``luna-ai-llama2`` model - lol)
8+
Lets learn how to setup a model, for this ``How To`` we are going to use the ``Dolphin 2.2.1 Mistral 7B`` model.
99

1010
To download the model to your models folder, run this command in a commandline of your picking.
1111
```bash
1212
curl --location 'http://localhost:8080/models/apply' \
1313
--header 'Content-Type: application/json' \
1414
--data-raw '{
15-
"id": "TheBloke/Luna-AI-Llama2-Uncensored-GGUF/luna-ai-llama2-uncensored.Q4_K_M.gguf"
15+
"id": "TheBloke/dolphin-2.2.1-mistral-7B-GGUF/dolphin-2.2.1-mistral-7b.Q4_0.gguf"
1616
}'
1717
```
1818

19-
Each model needs at least ``4`` files, with out these files, the model will run raw, what that means is you can not change settings of the model.
19+
Each model needs at least ``5`` files, with out these files, the model will run raw, what that means is you can not change settings of the model.
2020
```
2121
File 1 - The model's GGUF file
2222
File 2 - The model's .yaml file
2323
File 3 - The Chat API .tmpl file
24-
File 4 - The Completion API .tmpl file
24+
File 4 - The Chat API helper .tmpl file
25+
File 5 - The Completion API .tmpl file
2526
```
2627
So lets fix that! We are using ``lunademo`` name for this ``How To`` but you can name the files what ever you want! Lets make blank files to start with
2728

2829
```bash
2930
touch lunademo-chat.tmpl
31+
touch lunademo-chat-block.tmpl
3032
touch lunademo-completion.tmpl
3133
touch lunademo.yaml
3234
```
33-
Now lets edit the `"lunademo-chat.tmpl"`, Looking at the huggingface repo, this model uses the ``ASSISTANT:`` tag for when the AI replys, so lets make sure to add that to this file. Do not add the user as we will be doing that in our yaml file!
35+
Now lets edit the `"lunademo-chat.tmpl"`, This is the template that model "Chat" trained models use, but changed for LocalAI
3436

3537
```txt
36-
{{.Input}}
38+
<|im_start|>{{if eq .RoleName "assistant"}}assistant{{else if eq .RoleName "system"}}system{{else if eq .RoleName "user"}}user{{end}}
39+
{{if .Content}}{{.Content}}{{end}}
40+
<|im_end|>
41+
```
42+
43+
For the `"lunademo-chat-block.tmpl"`, Looking at the huggingface repo, this model uses the ``<|im_start|>assistant`` tag for when the AI replys, so lets make sure to add that to this file. Do not add the user as we will be doing that in our yaml file!
3744

38-
ASSISTANT:
45+
```txt
46+
{{.Input}}
47+
<|im_start|>assistant
3948
```
4049

41-
Now in the `"lunademo-completion.tmpl"` file lets add this.
50+
Now in the `"lunademo-completion.tmpl"` file lets add this. (This is a hold over from OpenAI V0)
4251

4352
```txt
44-
Complete the following sentence: {{.Input}}
53+
{{.Input}}
4554
```
4655

4756

@@ -58,25 +67,18 @@ What this does is tell ``LocalAI`` how to load the model. Then we are going to *
5867
```yaml
5968
name: lunademo
6069
parameters:
61-
model: luna-ai-llama2-uncensored.Q4_K_M.gguf
70+
model: dolphin-2.2.1-mistral-7b.Q4_0.gguf
6271
```
6372
64-
Now that we have the model set up, there a few things we should add to the yaml file to make it run better, for this model it uses the following roles.
65-
```yaml
66-
roles:
67-
assistant: 'ASSISTANT:'
68-
system: 'SYSTEM:'
69-
user: 'USER:'
70-
```
71-
72-
What that did is made sure that ``LocalAI`` added the test to the users in the request, so if a message is from ``system`` it shows up in the template as ``SYSTEM:``, speaking of template files, lets add those to our models yaml file now.
73+
Now that LocalAI knows what file to load with our request, lets add the template files to our models yaml file now.
7374
```yaml
7475
template:
75-
chat: lunademo-chat
76+
chat: lunademo-chat-block
77+
chat_message: lunademo-chat
7678
completion: lunademo-completion
7779
```
7880
79-
If you are running on ``GPU`` or want to tune the model, you can add settings like
81+
If you are running on ``GPU`` or want to tune the model, you can add settings like (higher the GPU Layers the more GPU used)
8082
```yaml
8183
f16: true
8284
gpu_layers: 4
@@ -85,8 +87,7 @@ gpu_layers: 4
8587
To fully tune the model to your like. But be warned, you **must** restart ``LocalAI`` after changing a yaml file
8688
8789
```bash
88-
docker-compose restart ##windows
89-
docker compose restart ##linux / mac
90+
docker compose restart
9091
```
9192

9293
If you want to check your models yaml, here is a full copy!
@@ -96,19 +97,18 @@ context_size: 2000
9697
##Put settings right here for tunning!! Before name but after Backend!
9798
name: lunademo
9899
parameters:
99-
model: luna-ai-llama2-uncensored.Q4_K_M.gguf
100-
roles:
101-
assistant: 'ASSISTANT:'
102-
system: 'SYSTEM:'
103-
user: 'USER:'
100+
model: dolphin-2.2.1-mistral-7b.Q4_0.gguf
104101
template:
105-
chat: lunademo-chat
102+
chat: lunademo-chat-block
103+
chat_message: lunademo-chat
106104
completion: lunademo-completion
107105
```
108106
109107
Now that we got that setup, lets test it out but sending a [request]({{%relref "easy-request" %}}) to Localai!
110108
111-
## Adv Stuff
109+
## ----- Adv Stuff -----
110+
111+
**(Please do not run these steps if you have already done the setup)**
112112
Alright now that we have learned how to set up our own models, here is how to use the gallery to do alot of this for us. This command will download and set up (mostly, we will **always** need to edit our yaml file to fit our computer / hardware)
113113
```bash
114114
curl http://localhost:8080/models/apply -H "Content-Type: application/json" -d '{

docs/content/howtos/easy-setup-docker-cpu.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,33 @@ weight = 2
77

88
{{% notice Note %}}
99
- You will need about 10gb of RAM Free
10-
- You will need about 15gb of space free on C drive for ``Docker-compose``
10+
- You will need about 15gb of space free on C drive for ``Docker compose``
1111
{{% /notice %}}
1212

13-
We are going to run `LocalAI` with `docker-compose` for this set up.
13+
We are going to run `LocalAI` with `docker compose` for this set up.
1414

15-
16-
Lets clone `LocalAI` with git.
17-
18-
```bash
19-
git clone https://github.com/go-skynet/LocalAI
15+
Lets setup our folders for ``LocalAI``
16+
{{< tabs >}}
17+
{{% tab name="Windows (Batch)" %}}
18+
```batch
19+
mkdir "LocalAI"
20+
cd LocalAI
21+
mkdir "models"
22+
mkdir "images"
2023
```
24+
{{% /tab %}}
2125

22-
23-
Then we will cd into the ``LocalAI`` folder.
24-
26+
{{% tab name="Linux (Bash / WSL)" %}}
2527
```bash
28+
mkdir -p "LocalAI"
2629
cd LocalAI
30+
mkdir -p "models"
31+
mkdir -p "images"
2732
```
33+
{{% /tab %}}
34+
{{< /tabs >}}
2835

29-
30-
At this point we want to set up our `.env` file, here is a copy for you to use if you wish, please make sure to set it to the same as in the `docker-compose` file for later.
36+
At this point we want to set up our `.env` file, here is a copy for you to use if you wish, Make sure this is in the ``LocalAI`` folder.
3137

3238
```bash
3339
## Set number of threads.
@@ -102,8 +108,7 @@ services:
102108
Make sure to save that in the root of the `LocalAI` folder. Then lets spin up the Docker run this in a `CMD` or `BASH`
103109

104110
```bash
105-
docker-compose up -d --pull always ##Windows
106-
docker compose up -d --pull always ##Linux
111+
docker compose up -d --pull always
107112
```
108113

109114

docs/content/howtos/easy-setup-docker-gpu.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,33 @@ weight = 2
77

88
{{% notice Note %}}
99
- You will need about 10gb of RAM Free
10-
- You will need about 15gb of space free on C drive for ``Docker-compose``
10+
- You will need about 15gb of space free on C drive for ``Docker compose``
1111
{{% /notice %}}
1212

13-
We are going to run `LocalAI` with `docker-compose` for this set up.
13+
We are going to run `LocalAI` with `docker compose` for this set up.
1414

15-
16-
Lets clone `LocalAI` with git.
17-
18-
```bash
19-
git clone https://github.com/go-skynet/LocalAI
15+
Lets Setup our folders for ``LocalAI``
16+
{{< tabs >}}
17+
{{% tab name="Windows (Batch)" %}}
18+
```batch
19+
mkdir "LocalAI"
20+
cd LocalAI
21+
mkdir "models"
22+
mkdir "images"
2023
```
24+
{{% /tab %}}
2125

22-
23-
Then we will cd into the `LocalAI` folder.
24-
26+
{{% tab name="Linux (Bash / WSL)" %}}
2527
```bash
28+
mkdir -p "LocalAI"
2629
cd LocalAI
30+
mkdir -p "models"
31+
mkdir -p "images"
2732
```
33+
{{% /tab %}}
34+
{{< /tabs >}}
2835

29-
30-
At this point we want to set up our `.env` file, here is a copy for you to use if you wish, please make sure to set it to the same as in the `docker-compose` file for later.
36+
At this point we want to set up our `.env` file, here is a copy for you to use if you wish, Make sure this is in the ``LocalAI`` folder.
3137

3238
```bash
3339
## Set number of threads.
@@ -134,8 +140,7 @@ services:
134140
Make sure to save that in the root of the `LocalAI` folder. Then lets spin up the Docker run this in a `CMD` or `BASH`
135141

136142
```bash
137-
docker-compose up -d --pull always ##Windows
138-
docker compose up -d --pull always ##Linux
143+
docker compose up -d --pull always
139144
```
140145

141146

0 commit comments

Comments
 (0)