MaziyarPanahi commited on
Commit
3b4bafa
1 Parent(s): 3f695f8

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +114 -0
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ library_name: transformers
6
+ tags:
7
+ - axolotl
8
+ - finetune
9
+ - dpo
10
+ - microsoft
11
+ - phi
12
+ - pytorch
13
+ - phi-3
14
+ - nlp
15
+ - code
16
+ - chatml
17
+ base_model: microsoft/Phi-3-mini-4k-instruct
18
+ datasets:
19
+ - MaziyarPanahi/truthy-dpo-v0.1-axolotl
20
+ model_name: Phi-3-mini-4k-instruct-v0.1
21
+ pipeline_tag: text-generation
22
+ inference: false
23
+ model_creator: MaziyarPanahi
24
+ quantized_by: MaziyarPanahi
25
+ ---
26
+
27
+ <img src="./phi-3-instruct.webp" alt="Phi-3 Logo" width="500" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
28
+
29
+
30
+ # MaziyarPanahi/Phi-3-mini-4k-instruct-v0.1
31
+
32
+ This model is a fine-tune (DPO) of `meta-llama/Meta-Llama-3-70B-Instruct` model.
33
+
34
+ # ⚡ Quantized GGUF
35
+
36
+ coming soon
37
+
38
+ # 🏆 [Open LLM Leaderboard Evaluation Results](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
39
+ coming soon
40
+
41
+ # Prompt Template
42
+
43
+ This model uses `ChatML` prompt template:
44
+
45
+ ```
46
+ <|im_start|>system
47
+ {System}
48
+ <|im_end|>
49
+ <|im_start|>user
50
+ {User}
51
+ <|im_end|>
52
+ <|im_start|>assistant
53
+ {Assistant}
54
+ ````
55
+
56
+ # How to use
57
+
58
+ You can use this model by using `MaziyarPanahi/Phi-3-mini-4k-instruct-v0.1` as the model name in Hugging Face's
59
+ transformers library.
60
+
61
+ ```python
62
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
63
+ from transformers import pipeline
64
+ import torch
65
+
66
+ model_id = "MaziyarPanahi/Phi-3-mini-4k-instruct-v0.1"
67
+
68
+ model = AutoModelForCausalLM.from_pretrained(
69
+ model_id,
70
+ torch_dtype=torch.bfloat16,
71
+ device_map="auto",
72
+ trust_remote_code=True,
73
+ # attn_implementation="flash_attention_2"
74
+ )
75
+
76
+ tokenizer = AutoTokenizer.from_pretrained(
77
+ model_id,
78
+ trust_remote_code=True
79
+ )
80
+
81
+ streamer = TextStreamer(tokenizer)
82
+
83
+ messages = [
84
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
85
+ {"role": "user", "content": "Who are you?"},
86
+ ]
87
+
88
+ terminators = [
89
+ tokenizer.eos_token_id,
90
+ tokenizer.convert_tokens_to_ids("<|im_end|>"),
91
+ tokenizer.convert_tokens_to_ids("<|assistant|>"),
92
+ tokenizer.convert_tokens_to_ids("<|end|>")
93
+ ]
94
+
95
+ pipe = pipeline(
96
+ "text-generation",
97
+ model=model,
98
+ tokenizer=tokenizer,
99
+ )
100
+
101
+ generation_args = {
102
+ "max_new_tokens": 500,
103
+ "return_full_text": False,
104
+ "temperature": 0.0,
105
+ "do_sample": False,
106
+ "streamer": streamer,
107
+ "eos_token_id": terminators,
108
+ }
109
+
110
+ output = pipe(messages, **generation_args)
111
+ print(output[0]['generated_text'])
112
+
113
+
114
+ ```