Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: amazon/MistralLite
|
3 |
+
inference: false
|
4 |
+
license: apache-2.0
|
5 |
+
model_creator: Amazon Web Services
|
6 |
+
model_name: MistralLite 7B
|
7 |
+
model_type: mistral
|
8 |
+
prompt_template: '<|prompter|>{prompt}</s><|assistant|>
|
9 |
+
|
10 |
+
'
|
11 |
+
quantized_by: TheBloke
|
12 |
+
---
|
13 |
+
|
14 |
+
<!-- header start -->
|
15 |
+
<!-- 200823 -->
|
16 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
17 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
18 |
+
</div>
|
19 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
20 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
21 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
22 |
+
</div>
|
23 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
24 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
<div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
|
28 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
29 |
+
<!-- header end -->
|
30 |
+
|
31 |
+
# MistralLite 7B - GGUF
|
32 |
+
- Model creator: [Amazon Web Services](https://huggingface.co/amazon)
|
33 |
+
- Original model: [MistralLite 7B](https://huggingface.co/amazon/MistralLite)
|
34 |
+
|
35 |
+
<!-- description start -->
|
36 |
+
## Description
|
37 |
+
|
38 |
+
This repo contains GGUF format model files for [Amazon Web Services's MistralLite 7B](https://huggingface.co/amazon/MistralLite).
|
39 |
+
|
40 |
+
<!-- description end -->
|
41 |
+
<!-- README_GGUF.md-about-gguf start -->
|
42 |
+
### About GGUF
|
43 |
+
|
44 |
+
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
|
45 |
+
|
46 |
+
Here is an incomplate list of clients and libraries that are known to support GGUF:
|
47 |
+
|
48 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
|
49 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
|
50 |
+
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
|
51 |
+
* [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
|
52 |
+
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
|
53 |
+
* [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
|
54 |
+
* [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
|
55 |
+
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
|
56 |
+
* [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
|
57 |
+
|
58 |
+
<!-- README_GGUF.md-about-gguf end -->
|
59 |
+
<!-- repositories-available start -->
|
60 |
+
## Repositories available
|
61 |
+
|
62 |
+
* [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/MistralLite-7B-AWQ)
|
63 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/MistralLite-7B-GPTQ)
|
64 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/MistralLite-7B-GGUF)
|
65 |
+
* [Amazon Web Services's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/amazon/MistralLite)
|
66 |
+
<!-- repositories-available end -->
|
67 |
+
|
68 |
+
<!-- prompt-template start -->
|
69 |
+
## Prompt template: Amazon
|
70 |
+
|
71 |
+
```
|
72 |
+
<|prompter|>{prompt}</s><|assistant|>
|
73 |
+
|
74 |
+
```
|
75 |
+
|
76 |
+
<!-- prompt-template end -->
|
77 |
+
|
78 |
+
|
79 |
+
<!-- compatibility_gguf start -->
|
80 |
+
## Compatibility
|
81 |
+
|
82 |
+
These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
|
83 |
+
|
84 |
+
They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
|
85 |
+
|
86 |
+
## Explanation of quantisation methods
|
87 |
+
<details>
|
88 |
+
<summary>Click to see details</summary>
|
89 |
+
|
90 |
+
The new methods available are:
|
91 |
+
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
92 |
+
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
93 |
+
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
94 |
+
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
95 |
+
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
|
96 |
+
|
97 |
+
Refer to the Provided Files table below to see what files use which methods, and how.
|
98 |
+
</details>
|
99 |
+
<!-- compatibility_gguf end -->
|
100 |
+
|
101 |
+
<!-- README_GGUF.md-provided-files start -->
|
102 |
+
## Provided files
|
103 |
+
|
104 |
+
| Name | Quant method | Bits | Size | Max RAM required | Use case |
|
105 |
+
| ---- | ---- | ---- | ---- | ---- | ----- |
|
106 |
+
| [mistrallite.Q2_K.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q2_K.gguf) | Q2_K | 2 | 3.08 GB| 5.58 GB | smallest, significant quality loss - not recommended for most purposes |
|
107 |
+
| [mistrallite.Q3_K_S.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q3_K_S.gguf) | Q3_K_S | 3 | 3.16 GB| 5.66 GB | very small, high quality loss |
|
108 |
+
| [mistrallite.Q3_K_M.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q3_K_M.gguf) | Q3_K_M | 3 | 3.52 GB| 6.02 GB | very small, high quality loss |
|
109 |
+
| [mistrallite.Q3_K_L.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q3_K_L.gguf) | Q3_K_L | 3 | 3.82 GB| 6.32 GB | small, substantial quality loss |
|
110 |
+
| [mistrallite.Q4_0.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q4_0.gguf) | Q4_0 | 4 | 4.11 GB| 6.61 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
|
111 |
+
| [mistrallite.Q4_K_S.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q4_K_S.gguf) | Q4_K_S | 4 | 4.14 GB| 6.64 GB | small, greater quality loss |
|
112 |
+
| [mistrallite.Q4_K_M.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q4_K_M.gguf) | Q4_K_M | 4 | 4.37 GB| 6.87 GB | medium, balanced quality - recommended |
|
113 |
+
| [mistrallite.Q5_0.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q5_0.gguf) | Q5_0 | 5 | 5.00 GB| 7.50 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
|
114 |
+
| [mistrallite.Q5_K_S.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q5_K_S.gguf) | Q5_K_S | 5 | 5.00 GB| 7.50 GB | large, low quality loss - recommended |
|
115 |
+
| [mistrallite.Q5_K_M.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q5_K_M.gguf) | Q5_K_M | 5 | 5.13 GB| 7.63 GB | large, very low quality loss - recommended |
|
116 |
+
| [mistrallite.Q6_K.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q6_K.gguf) | Q6_K | 6 | 5.94 GB| 8.44 GB | very large, extremely low quality loss |
|
117 |
+
| [mistrallite.Q8_0.gguf](https://huggingface.co/TheBloke/MistralLite-7B-GGUF/blob/main/mistrallite.Q8_0.gguf) | Q8_0 | 8 | 7.70 GB| 10.20 GB | very large, extremely low quality loss - not recommended |
|
118 |
+
|
119 |
+
**Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
<!-- README_GGUF.md-provided-files end -->
|
124 |
+
|
125 |
+
<!-- README_GGUF.md-how-to-download start -->
|
126 |
+
## How to download GGUF files
|
127 |
+
|
128 |
+
**Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
|
129 |
+
|
130 |
+
The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
|
131 |
+
- LM Studio
|
132 |
+
- LoLLMS Web UI
|
133 |
+
- Faraday.dev
|
134 |
+
|
135 |
+
### In `text-generation-webui`
|
136 |
+
|
137 |
+
Under Download Model, you can enter the model repo: TheBloke/MistralLite-7B-GGUF and below it, a specific filename to download, such as: mistrallite.Q4_K_M.gguf.
|
138 |
+
|
139 |
+
Then click Download.
|
140 |
+
|
141 |
+
### On the command line, including multiple files at once
|
142 |
+
|
143 |
+
I recommend using the `huggingface-hub` Python library:
|
144 |
+
|
145 |
+
```shell
|
146 |
+
pip3 install huggingface-hub
|
147 |
+
```
|
148 |
+
|
149 |
+
Then you can download any individual model file to the current directory, at high speed, with a command like this:
|
150 |
+
|
151 |
+
```shell
|
152 |
+
huggingface-cli download TheBloke/MistralLite-7B-GGUF mistrallite.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
|
153 |
+
```
|
154 |
+
|
155 |
+
<details>
|
156 |
+
<summary>More advanced huggingface-cli download usage</summary>
|
157 |
+
|
158 |
+
You can also download multiple files at once with a pattern:
|
159 |
+
|
160 |
+
```shell
|
161 |
+
huggingface-cli download TheBloke/MistralLite-7B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
|
162 |
+
```
|
163 |
+
|
164 |
+
For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
|
165 |
+
|
166 |
+
To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
|
167 |
+
|
168 |
+
```shell
|
169 |
+
pip3 install hf_transfer
|
170 |
+
```
|
171 |
+
|
172 |
+
And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
|
173 |
+
|
174 |
+
```shell
|
175 |
+
HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/MistralLite-7B-GGUF mistrallite.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
|
176 |
+
```
|
177 |
+
|
178 |
+
Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
|
179 |
+
</details>
|
180 |
+
<!-- README_GGUF.md-how-to-download end -->
|
181 |
+
|
182 |
+
<!-- README_GGUF.md-how-to-run start -->
|
183 |
+
## Example `llama.cpp` command
|
184 |
+
|
185 |
+
Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
|
186 |
+
|
187 |
+
```shell
|
188 |
+
./main -ngl 32 -m mistrallite.Q4_K_M.gguf --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<|prompter|>{prompt}</s><|assistant|>"
|
189 |
+
```
|
190 |
+
|
191 |
+
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
192 |
+
|
193 |
+
Change `-c 2048` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically.
|
194 |
+
|
195 |
+
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
196 |
+
|
197 |
+
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
198 |
+
|
199 |
+
## How to run in `text-generation-webui`
|
200 |
+
|
201 |
+
Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
|
202 |
+
|
203 |
+
## How to run from Python code
|
204 |
+
|
205 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries.
|
206 |
+
|
207 |
+
### How to load this model in Python code, using ctransformers
|
208 |
+
|
209 |
+
#### First install the package
|
210 |
+
|
211 |
+
Run one of the following commands, according to your system:
|
212 |
+
|
213 |
+
```shell
|
214 |
+
# Base ctransformers with no GPU acceleration
|
215 |
+
pip install ctransformers
|
216 |
+
# Or with CUDA GPU acceleration
|
217 |
+
pip install ctransformers[cuda]
|
218 |
+
# Or with AMD ROCm GPU acceleration (Linux only)
|
219 |
+
CT_HIPBLAS=1 pip install ctransformers --no-binary ctransformers
|
220 |
+
# Or with Metal GPU acceleration for macOS systems only
|
221 |
+
CT_METAL=1 pip install ctransformers --no-binary ctransformers
|
222 |
+
```
|
223 |
+
|
224 |
+
#### Simple ctransformers example code
|
225 |
+
|
226 |
+
```python
|
227 |
+
from ctransformers import AutoModelForCausalLM
|
228 |
+
|
229 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
230 |
+
llm = AutoModelForCausalLM.from_pretrained("TheBloke/MistralLite-7B-GGUF", model_file="mistrallite.Q4_K_M.gguf", model_type="mistral", gpu_layers=50)
|
231 |
+
|
232 |
+
print(llm("AI is going to"))
|
233 |
+
```
|
234 |
+
|
235 |
+
## How to use with LangChain
|
236 |
+
|
237 |
+
Here are guides on using llama-cpp-python and ctransformers with LangChain:
|
238 |
+
|
239 |
+
* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
|
240 |
+
* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
|
241 |
+
|
242 |
+
<!-- README_GGUF.md-how-to-run end -->
|
243 |
+
|
244 |
+
<!-- footer start -->
|
245 |
+
<!-- 200823 -->
|
246 |
+
## Discord
|
247 |
+
|
248 |
+
For further support, and discussions on these models and AI in general, join us at:
|
249 |
+
|
250 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
251 |
+
|
252 |
+
## Thanks, and how to contribute
|
253 |
+
|
254 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
255 |
+
|
256 |
+
Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
|
257 |
+
|
258 |
+
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
|
259 |
+
|
260 |
+
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
|
261 |
+
|
262 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
263 |
+
|
264 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
265 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
266 |
+
|
267 |
+
**Special thanks to**: Aemon Algiz.
|
268 |
+
|
269 |
+
**Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
|
270 |
+
|
271 |
+
|
272 |
+
Thank you to all my generous patrons and donaters!
|
273 |
+
|
274 |
+
And thank you again to a16z for their generous grant.
|
275 |
+
|
276 |
+
<!-- footer end -->
|
277 |
+
|
278 |
+
<!-- original-model-card start -->
|
279 |
+
# Original model card: Amazon Web Services's MistralLite 7B
|
280 |
+
|
281 |
+
|
282 |
+
# MistralLite Model
|
283 |
+
|
284 |
+
MistralLite is a fine-tuned [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) language model, with enhanced capabilities of processing long context (up to 32K tokens). By utilizing an adapted Rotary Embedding and sliding window during fine-tuning, MistralLite is able to **perform significantly better on several long context retrieve and answering tasks**, while keeping the simple model structure of the original model. MistralLite is useful for applications such as long context line and topic retrieval, summarization, question-answering, and etc. MistralLite can be deployed on a single AWS `g5.2x` instance with Sagemaker [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) endpoint, making it suitable for applications that require high performance in resource-constrained environments. You can also serve the MistralLite model directly using TGI docker containers. Also, MistralLite supports other ways of serving like [vLLM](https://github.com/vllm-project/vllm), and you can use MistralLite in Python by using the [HuggingFace transformers](https://huggingface.co/docs/transformers/index) and [FlashAttention-2](https://github.com/Dao-AILab/flash-attention) library.
|
285 |
+
|
286 |
+
MistralLite is similar to [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1), and their similarities and differences are summarized below:
|
287 |
+
|Model|Fine-tuned on long contexts| Max context length| RotaryEmbedding adaptation| Sliding Window Size|
|
288 |
+
|----------|-------------:|------------:|-----------:|-----------:|
|
289 |
+
| Mistral-7B-Instruct-v0.1 | up to 8K tokens | 32K | rope_theta = 10000 | 4096 |
|
290 |
+
| MistralLite | up to 16K tokens | 32K | **rope_theta = 1000000** | **16384** |
|
291 |
+
|
292 |
+
## Motivation of Developing MistralLite
|
293 |
+
|
294 |
+
Since the release of [Mistral-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1), the model became increasingly popular because its strong performance
|
295 |
+
on a wide range of benchmarks. But most of the benchmarks are evaluated on `short context`, and not much has been investigated on its performance on long context tasks.
|
296 |
+
Then We evaluated `Mistral-7B-Instruct-v0.1` against benchmarks that are specifically designed to assess the capabilities of LLMs in handling longer context.
|
297 |
+
Although the performance of the models on long context was fairly competitive on long context less than 4096 tokens,
|
298 |
+
there were some limitations on its performance on longer context. Motivated by improving its performance on longer context, we finetuned the Mistral 7B model, and produced `Mistrallite`. The model managed to `significantly boost the performance of long context handling` over Mistral-7B-Instruct-v0.1. The detailed `long context evalutaion results` are as below:
|
299 |
+
|
300 |
+
1. [Topic Retrieval](https://lmsys.org/blog/2023-06-29-longchat/)
|
301 |
+
|Model Name|Input length| Input length | Input length| Input length| Input length|
|
302 |
+
|----------|-------------:|-------------:|------------:|-----------:|-----------:|
|
303 |
+
| | 2851| 5568 |8313 | 11044 | 13780
|
304 |
+
| Mistral-7B-Instruct-v0.1 | 100% | 50% | 2% | 0% | 0% |
|
305 |
+
| MistralLite | **100%** | **100%** | **100%** | **100%** | **98%** |
|
306 |
+
|
307 |
+
2. [Line Retrieval](https://lmsys.org/blog/2023-06-29-longchat/#longeval-results)
|
308 |
+
|
309 |
+
|Model Name|Input length| Input length | Input length| Input length| Input length|Input length|
|
310 |
+
|----------|-------------:|-------------:|------------:|-----------:|-----------:|-----------:|
|
311 |
+
| | 3818| 5661 |7505 | 9354 | 11188 | 12657
|
312 |
+
| Mistral-7B-Instruct-v0.1 | **98%** | 62% | 42% | 42% | 32% | 30% |
|
313 |
+
| MistralLite | **98%** | **92%** | **88%** | **76%** | **70%** | **60%** |
|
314 |
+
|
315 |
+
3. [Pass key Retrieval](https://github.com/epfml/landmark-attention/blob/main/llama/run_test.py#L101)
|
316 |
+
|
317 |
+
|Model Name|Input length| Input length | Input length| Input length|
|
318 |
+
|----------|-------------:|-------------:|------------:|-----------:|
|
319 |
+
| | 3264| 5396 |8329 | 10197 |
|
320 |
+
| Mistral-7B-Instruct-v0.1 | **100%** | 50% | 20% | 30% |
|
321 |
+
| MistralLite | **100%** | **100%** | **100%** | **100%** |
|
322 |
+
|
323 |
+
4. [Question Answering with Long Input Texts](https://nyu-mll.github.io/quality/)
|
324 |
+
|Model Name| Test set Accuracy | Hard subset Accuracy|
|
325 |
+
|----------|-------------:|-------------:|
|
326 |
+
| Mistral-7B-Instruct-v0.1 | 44.3% | 39.7% |
|
327 |
+
| MistralLite | **64.4%** | **56.2%** |
|
328 |
+
|
329 |
+
### Example test on long context of 13400 tokens
|
330 |
+
- Context is from [Amazon Aurora FAQs](https://aws.amazon.com/rds/aurora/faqs/)
|
331 |
+
- Question: *please tell me how does pgvector help with Generative AI and give me some examples.*
|
332 |
+
- Answer from MistralLite:
|
333 |
+
```code
|
334 |
+
pgvector is an open-source extension for PostgreSQL supported by Amazon Aurora PostgreSQL-Compatible Edition.
|
335 |
+
|
336 |
+
You can use pgvector to store, search, index, and query billions of embeddings that are generated from machine learning (ML) and artificial intelligence (AI) models in your database, such as those from Amazon Bedrock (limited preview) or Amazon SageMaker. A vector embedding is a numerical representation that represents the semantic meaning of content such as text, images, and video.
|
337 |
+
|
338 |
+
With pgvector, you can query embeddings in your Aurora PostgreSQL database to perform efficient semantic similarity searches of these data types, represented as vectors, combined with other tabular data in Aurora. This enables the use of generative AI and other AI/ML systems for new types of applications such as personalized recommendations based on similar text descriptions or images, candidate match based on interview notes, customer service next best action recommendations based on successful transcripts or chat session dialogs, and more.
|
339 |
+
```
|
340 |
+
|
341 |
+
## Model Details
|
342 |
+
|
343 |
+
- **Developed by:** [AWS Contributors](https://github.com/orgs/aws-samples/teams/aws-prototype-ml-apac)
|
344 |
+
- **Model type:** [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
|
345 |
+
- **Language:** English
|
346 |
+
- **Finetuned from weights:** [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)
|
347 |
+
- **Finetuned on data:**
|
348 |
+
- [SLidingEncoder and Decoder (SLED)](https://huggingface.co/datasets/tau/sled)
|
349 |
+
- [(Long) Natural Questions (NQ)](https://huggingface.co/datasets/togethercomputer/Long-Data-Collections#multi-passage-qa-from-natural-questions)
|
350 |
+
- [OpenAssistant Conversations Dataset (OASST1)](https://huggingface.co/datasets/OpenAssistant/oasst1)
|
351 |
+
- **Supported Serving Framework:**
|
352 |
+
- [Text-Generation-Inference 1.1.0](https://github.com/huggingface/text-generation-inference/tree/v1.1.0)
|
353 |
+
- [vLLM](https://github.com/vllm-project/vllm)
|
354 |
+
- [HuggingFace transformers](https://huggingface.co/docs/transformers/index)
|
355 |
+
- [HuggingFace Text Generation Inference (TGI) container on SageMaker](https://github.com/awslabs/llm-hosting-container)
|
356 |
+
- **Model License:** Apache 2.0
|
357 |
+
- **Contact:** [GitHub issues](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/issues)
|
358 |
+
- **Inference Code** [Github Repo](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/)
|
359 |
+
|
360 |
+
## How to Use MistralLite from Python Code (HuggingFace transformers) ##
|
361 |
+
|
362 |
+
**Important** - For an end-to-end example Jupyter notebook, please refer to [this link](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/huggingface-transformers/example_usage.ipynb).
|
363 |
+
|
364 |
+
### Install the necessary packages
|
365 |
+
|
366 |
+
Requires: [transformers](https://pypi.org/project/transformers/) 4.34.0 or later, [flash-attn](https://pypi.org/project/flash-attn/) 2.3.1.post1 or later,
|
367 |
+
and [accelerate](https://pypi.org/project/accelerate/) 0.23.0 or later.
|
368 |
+
|
369 |
+
```shell
|
370 |
+
pip install transformers==4.34.0
|
371 |
+
pip install flash-attn==2.3.1.post1 --no-build-isolation
|
372 |
+
pip install accelerate==0.23.0
|
373 |
+
```
|
374 |
+
### You can then try the following example code
|
375 |
+
|
376 |
+
```python
|
377 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
378 |
+
import transformers
|
379 |
+
import torch
|
380 |
+
|
381 |
+
model_id = "amazon/MistralLite"
|
382 |
+
|
383 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
384 |
+
model = AutoModelForCausalLM.from_pretrained(model_id,
|
385 |
+
torch_dtype=torch.bfloat16,
|
386 |
+
use_flash_attention_2=True,
|
387 |
+
device_map="auto",)
|
388 |
+
pipeline = transformers.pipeline(
|
389 |
+
"text-generation",
|
390 |
+
model=model,
|
391 |
+
tokenizer=tokenizer,
|
392 |
+
)
|
393 |
+
prompt = "<|prompter|>What are the main challenges to support a long context for LLM?</s><|assistant|>"
|
394 |
+
|
395 |
+
sequences = pipeline(
|
396 |
+
prompt,
|
397 |
+
max_new_tokens=400,
|
398 |
+
do_sample=False,
|
399 |
+
return_full_text=False,
|
400 |
+
num_return_sequences=1,
|
401 |
+
eos_token_id=tokenizer.eos_token_id,
|
402 |
+
)
|
403 |
+
for seq in sequences:
|
404 |
+
print(f"{seq['generated_text']}")
|
405 |
+
```
|
406 |
+
**Important** - Use the prompt template below for MistralLite:
|
407 |
+
```
|
408 |
+
<|prompter|>What are the main challenges to support a long context for LLM?</s><|assistant|>
|
409 |
+
```
|
410 |
+
|
411 |
+
## How to Serve MistralLite on TGI ##
|
412 |
+
**Important:**
|
413 |
+
- For an end-to-end example Jupyter notebook using the native TGI container, please refer to [this link](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/tgi/example_usage.ipynb).
|
414 |
+
- If the **input context length is greater than 12K tokens**, it is recommended using a custom TGI container, please refer to [this link](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/tgi-custom/example_usage.ipynb).
|
415 |
+
|
416 |
+
### Start TGI server ###
|
417 |
+
Use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
|
418 |
+
|
419 |
+
Example Docker parameters:
|
420 |
+
|
421 |
+
```shell
|
422 |
+
docker run -d --gpus all --shm-size 1g -p 443:80 -v $(pwd)/models:/data ghcr.io/huggingface/text-generation-inference:1.1.0 \
|
423 |
+
--model-id amazon/MistralLite \
|
424 |
+
--max-input-length 16000 \
|
425 |
+
--max-total-tokens 16384 \
|
426 |
+
--max-batch-prefill-tokens 16384 \
|
427 |
+
--trust-remote-code
|
428 |
+
```
|
429 |
+
|
430 |
+
### Perform Inference ###
|
431 |
+
Example Python code for inference with TGI (requires `text_generation` 0.6.1 or later):
|
432 |
+
|
433 |
+
```shell
|
434 |
+
pip install text_generation==0.6.1
|
435 |
+
```
|
436 |
+
|
437 |
+
```python
|
438 |
+
from text_generation import Client
|
439 |
+
|
440 |
+
SERVER_PORT = 443
|
441 |
+
SERVER_HOST = "localhost"
|
442 |
+
SERVER_URL = f"{SERVER_HOST}:{SERVER_PORT}"
|
443 |
+
tgi_client = Client(f"http://{SERVER_URL}", timeout=60)
|
444 |
+
|
445 |
+
def invoke_tgi(prompt,
|
446 |
+
random_seed=1,
|
447 |
+
max_new_tokens=400,
|
448 |
+
print_stream=True,
|
449 |
+
assist_role=True):
|
450 |
+
if (assist_role):
|
451 |
+
prompt = f"<|prompter|>{prompt}</s><|assistant|>"
|
452 |
+
output = ""
|
453 |
+
for response in tgi_client.generate_stream(
|
454 |
+
prompt,
|
455 |
+
do_sample=False,
|
456 |
+
max_new_tokens=max_new_tokens,
|
457 |
+
return_full_text=False,
|
458 |
+
#temperature=None,
|
459 |
+
#truncate=None,
|
460 |
+
#seed=random_seed,
|
461 |
+
#typical_p=0.2,
|
462 |
+
):
|
463 |
+
if hasattr(response, "token"):
|
464 |
+
if not response.token.special:
|
465 |
+
snippet = response.token.text
|
466 |
+
output += snippet
|
467 |
+
if (print_stream):
|
468 |
+
print(snippet, end='', flush=True)
|
469 |
+
return output
|
470 |
+
|
471 |
+
prompt = "What are the main challenges to support a long context for LLM?"
|
472 |
+
result = invoke_tgi(prompt)
|
473 |
+
```
|
474 |
+
|
475 |
+
**Important** - When using MistralLite for inference for the first time, it may require a brief 'warm-up' period that can take 10s of seconds. However, subsequent inferences should be faster and return results in a more timely manner. This warm-up period is normal and should not affect the overall performance of the system once the initialisation period has been completed.
|
476 |
+
|
477 |
+
|
478 |
+
## How to Deploy MistralLite on Amazon SageMaker ##
|
479 |
+
**Important:**
|
480 |
+
- For an end-to-end example Jupyter notebook using the SageMaker built-in container, please refer to [this link](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/sagemaker-tgi/example_usage.ipynb).
|
481 |
+
- If the **input context length is greater than 12K tokens**, it is recommended using a custom docker container, please refer to [this link](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/sagemaker-tgi-custom/example_usage.ipynb).
|
482 |
+
|
483 |
+
### Install the necessary packages
|
484 |
+
|
485 |
+
Requires: [sagemaker](https://pypi.org/project/sagemaker/) 2.192.1 or later.
|
486 |
+
|
487 |
+
```shell
|
488 |
+
pip install sagemaker==2.192.1
|
489 |
+
```
|
490 |
+
|
491 |
+
### Deploy the Model as A SageMaker Endpoint ###
|
492 |
+
To deploy MistralLite on a SageMaker endpoint, please follow the example code as below.
|
493 |
+
```python
|
494 |
+
import sagemaker
|
495 |
+
from sagemaker.huggingface import HuggingFaceModel, get_huggingface_llm_image_uri
|
496 |
+
import time
|
497 |
+
|
498 |
+
sagemaker_session = sagemaker.Session()
|
499 |
+
region = sagemaker_session.boto_region_name
|
500 |
+
role = sagemaker.get_execution_role()
|
501 |
+
|
502 |
+
image_uri = get_huggingface_llm_image_uri(
|
503 |
+
backend="huggingface", # or lmi
|
504 |
+
region=region,
|
505 |
+
version="1.1.0"
|
506 |
+
)
|
507 |
+
|
508 |
+
model_name = "MistralLite-" + time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime())
|
509 |
+
|
510 |
+
hub = {
|
511 |
+
'HF_MODEL_ID':'amazon/MistralLite',
|
512 |
+
'HF_TASK':'text-generation',
|
513 |
+
'SM_NUM_GPUS':'1',
|
514 |
+
"MAX_INPUT_LENGTH": '16000',
|
515 |
+
"MAX_TOTAL_TOKENS": '16384',
|
516 |
+
"MAX_BATCH_PREFILL_TOKENS": '16384',
|
517 |
+
"MAX_BATCH_TOTAL_TOKENS": '16384',
|
518 |
+
}
|
519 |
+
|
520 |
+
model = HuggingFaceModel(
|
521 |
+
name=model_name,
|
522 |
+
env=hub,
|
523 |
+
role=role,
|
524 |
+
image_uri=image_uri
|
525 |
+
)
|
526 |
+
predictor = model.deploy(
|
527 |
+
initial_instance_count=1,
|
528 |
+
instance_type="ml.g5.2xlarge",
|
529 |
+
endpoint_name=model_name,
|
530 |
+
|
531 |
+
)
|
532 |
+
```
|
533 |
+
|
534 |
+
### Perform Inference ###
|
535 |
+
To call the endpoint, please follow the example code as below:
|
536 |
+
|
537 |
+
```python
|
538 |
+
input_data = {
|
539 |
+
"inputs": "<|prompter|>What are the main challenges to support a long context for LLM?</s><|assistant|>",
|
540 |
+
"parameters": {
|
541 |
+
"do_sample": False,
|
542 |
+
"max_new_tokens": 400,
|
543 |
+
"return_full_text": False,
|
544 |
+
#"typical_p": 0.2,
|
545 |
+
#"temperature":None,
|
546 |
+
#"truncate":None,
|
547 |
+
#"seed": 1,
|
548 |
+
}
|
549 |
+
}
|
550 |
+
result = predictor.predict(input_data)[0]["generated_text"]
|
551 |
+
print(result)
|
552 |
+
```
|
553 |
+
or via [boto3](https://pypi.org/project/boto3/), and the example code is shown as below:
|
554 |
+
|
555 |
+
```python
|
556 |
+
import boto3
|
557 |
+
import json
|
558 |
+
def call_endpoint(client, prompt, endpoint_name, paramters):
|
559 |
+
client = boto3.client("sagemaker-runtime")
|
560 |
+
payload = {"inputs": prompt,
|
561 |
+
"parameters": parameters}
|
562 |
+
response = client.invoke_endpoint(EndpointName=endpoint_name,
|
563 |
+
Body=json.dumps(payload),
|
564 |
+
ContentType="application/json")
|
565 |
+
output = json.loads(response["Body"].read().decode())
|
566 |
+
result = output[0]["generated_text"]
|
567 |
+
return result
|
568 |
+
|
569 |
+
client = boto3.client("sagemaker-runtime")
|
570 |
+
parameters = {
|
571 |
+
"do_sample": False,
|
572 |
+
"max_new_tokens": 400,
|
573 |
+
"return_full_text": False,
|
574 |
+
#"typical_p": 0.2,
|
575 |
+
#"temperature":None,
|
576 |
+
#"truncate":None,
|
577 |
+
#"seed": 1,
|
578 |
+
}
|
579 |
+
endpoint_name = predictor.endpoint_name
|
580 |
+
prompt = "<|prompter|>What are the main challenges to support a long context for LLM?</s><|assistant|>"
|
581 |
+
result = call_endpoint(client, prompt, endpoint_name, parameters)
|
582 |
+
print(result)
|
583 |
+
```
|
584 |
+
|
585 |
+
|
586 |
+
## How to Serve MistralLite on vLLM ##
|
587 |
+
Documentation on installing and using vLLM [can be found here](https://vllm.readthedocs.io/en/latest/).
|
588 |
+
|
589 |
+
**Important** - For an end-to-end example Jupyter notebook, please refer to [this link](https://github.com/awslabs/extending-the-context-length-of-open-source-llms/blob/main/MistralLite/vllm/example_usage.ipynb).
|
590 |
+
|
591 |
+
### Using vLLM as a server ###
|
592 |
+
When using vLLM as a server, pass the --model amazon/MistralLite parameter, for example:
|
593 |
+
```shell
|
594 |
+
python3 -m vllm.entrypoints.api_server --model amazon/MistralLite
|
595 |
+
```
|
596 |
+
|
597 |
+
### Using vLLM in Python Code ###
|
598 |
+
When using vLLM from Python code, Please see the example code as below:
|
599 |
+
|
600 |
+
```python
|
601 |
+
from vllm import LLM, SamplingParams
|
602 |
+
|
603 |
+
prompts = [
|
604 |
+
"<|prompter|>What are the main challenges to support a long context for LLM?</s><|assistant|>",
|
605 |
+
]
|
606 |
+
sampling_params = SamplingParams(temperature=0, max_tokens=100)
|
607 |
+
|
608 |
+
llm = LLM(model="amazon/MistralLite",)
|
609 |
+
|
610 |
+
outputs = llm.generate(prompts, sampling_params)
|
611 |
+
|
612 |
+
# Print the outputs.
|
613 |
+
for output in outputs:
|
614 |
+
prompt = output.prompt
|
615 |
+
generated_text = output.outputs[0].text
|
616 |
+
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
|
617 |
+
```
|
618 |
+
|
619 |
+
## Limitations ##
|
620 |
+
Before using the MistralLite model, it is important to perform your own independent assessment, and take measures to ensure that your use would comply with your own specific quality control practices and standards, and that your use would comply with the local rules, laws, regulations, licenses and terms that apply to you, and your content.
|
621 |
+
|
622 |
+
<!-- original-model-card end -->
|