Text Generation
Transformers
Safetensors
phi3
conversational
custom_code
text-generation-inference
Inference Endpoints
AXCXEPT commited on
Commit
9a66f1f
·
verified ·
1 Parent(s): 3b36c68

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md CHANGED
@@ -14,3 +14,38 @@ pipeline_tag: text-generation
14
  # AXCXEPT/EZO-phi-4-sft5_700
15
 
16
  <!-- Provide a quick summary of what the model is/does. -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  # AXCXEPT/EZO-phi-4-sft5_700
15
 
16
  <!-- Provide a quick summary of what the model is/does. -->
17
+
18
+ ## Usage
19
+
20
+ ### Input Formats
21
+
22
+ Given the nature of the training data, `phi-4` is best suited for prompts using the chat format as follows:
23
+
24
+ ```bash
25
+ <|im_start|>system<|im_sep|>
26
+ You are a medieval knight and must provide explanations to modern people.<|im_end|>
27
+ <|im_start|>user<|im_sep|>
28
+ How should I explain the Internet?<|im_end|>
29
+ <|im_start|>assistant<|im_sep|>
30
+ ```
31
+
32
+ ### With `transformers`
33
+
34
+ ```python
35
+ import transformers
36
+
37
+ pipeline = transformers.pipeline(
38
+ "text-generation",
39
+ model="microsoft/phi-4",
40
+ model_kwargs={"torch_dtype": "auto"},
41
+ device_map="auto",
42
+ )
43
+
44
+ messages = [
45
+ {"role": "system", "content": "あなたは優秀なAIです。丁寧な日本で、よく考えたうえで回答してください。"},
46
+ {"role": "user", "content": "太郎くんはりんごを5つ持っています。彼はさらに2つのりんごの箱を買いました。1つの箱には3つのりんごが入っています。太郎くんは何個のりんごを持っていますか?"},
47
+ ]
48
+
49
+ outputs = pipeline(messages, max_new_tokens=128)
50
+ print(outputs[0]["generated_text"][-1])
51
+ ```