Update README.md
Browse files
README.md
CHANGED
|
@@ -49,7 +49,21 @@ print(outputs[0]["generated_text"])
|
|
| 49 |
|
| 50 |
## 💻 Usage for VLLM
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
```python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
def gen(instruction):
|
| 55 |
messages = [
|
|
|
|
| 49 |
|
| 50 |
## 💻 Usage for VLLM
|
| 51 |
|
| 52 |
+
Use with transformers
|
| 53 |
+
Starting with ```vllm``` onward, you can run conversational inference using the vLLM pipeline abstraction with the gen() function.
|
| 54 |
+
Make sure to update your vllm installation via ```pip install --upgrade vllm.```
|
| 55 |
+
|
| 56 |
```python
|
| 57 |
+
from vllm import LLM, SamplingParams
|
| 58 |
+
from transformers import AutoTokenizer, pipeline
|
| 59 |
+
|
| 60 |
+
BASE_MODEL = "sh2orc/Llama-3.1-Korean-8B-Instruct"
|
| 61 |
+
|
| 62 |
+
llm = LLM(model=BASE_MODEL)
|
| 63 |
+
|
| 64 |
+
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
|
| 65 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 66 |
+
tokenizer.padding_side = 'right'
|
| 67 |
|
| 68 |
def gen(instruction):
|
| 69 |
messages = [
|