ptrdvn commited on
Commit
e1b5a68
·
1 Parent(s): 6a6e9e0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -0
README.md CHANGED
@@ -16,6 +16,7 @@ language:
16
 
17
  # How to use
18
 
 
19
  ```python
20
  from transformers import AutoTokenizer, AutoModelForCausalLM
21
  import torch
@@ -34,6 +35,27 @@ pipe(prompt, max_new_tokens=100, do_sample=False, temperature=0.0, return_full_t
34
  ```
35
 
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  # Base checkpoint
38
  augmxnt/shisa-7b-v1
39
  * Mistral-7B base
 
16
 
17
  # How to use
18
 
19
+ ### Hugggingface
20
  ```python
21
  from transformers import AutoTokenizer, AutoModelForCausalLM
22
  import torch
 
35
  ```
36
 
37
 
38
+ ### VLLM
39
+ ```python
40
+ from vllm import LLM, SamplingParams
41
+
42
+ sampling_params = SamplingParams(temperature=0.0, max_tokens=100)
43
+ llm = LLM(model="lightblue/karasu-7B")
44
+
45
+ messages = [{"role": "system", "content": "あなたはAIアシスタントです。"}]
46
+ messages.append({"role": "user", "content": "イギリスの首相は誰ですか?"})
47
+ prompt = llm.llm_engine.tokenizer.apply_chat_template(conversation=messages, add_generation_prompt=True, tokenize=False)
48
+ prompts = [prompt]
49
+
50
+ outputs = llm.generate(prompts, sampling_params)
51
+ for output in outputs:
52
+ prompt = output.prompt
53
+ generated_text = output.outputs[0].text
54
+ print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
55
+ ```
56
+
57
+
58
+
59
  # Base checkpoint
60
  augmxnt/shisa-7b-v1
61
  * Mistral-7B base