afrideva commited on
Commit
a6a8111
1 Parent(s): 75f647e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +64 -0
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: mzbac/Phi-3-mini-4k-grammar-correction
3
+ inference: true
4
+ license: mit
5
+ model_creator: mzbac
6
+ model_name: Phi-3-mini-4k-grammar-correction
7
+ pipeline_tag: text-generation
8
+ quantized_by: afrideva
9
+ tags:
10
+ - gguf
11
+ - ggml
12
+ - quantized
13
+ ---
14
+
15
+ # Phi-3-mini-4k-grammar-correction-GGUF
16
+
17
+ Quantized GGUF model files for [Phi-3-mini-4k-grammar-correction](https://huggingface.co/mzbac/Phi-3-mini-4k-grammar-correction) from [mzbac](https://huggingface.co/mzbac)
18
+
19
+ ## Original Model Card:
20
+
21
+ # Usage
22
+ ```python
23
+ from transformers import AutoTokenizer, AutoModelForCausalLM
24
+ import torch
25
+
26
+ model_id = "mzbac/Phi-3-mini-4k-grammar-correction"
27
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
28
+ model = AutoModelForCausalLM.from_pretrained(
29
+ model_id,
30
+ torch_dtype=torch.bfloat16,
31
+ device_map="auto",
32
+ )
33
+
34
+ messages = [
35
+ {
36
+ "role": "user",
37
+ "content": "Please correct, polish, or translate the text delimited by triple backticks to standard English.",
38
+ },
39
+ {
40
+ "role": "user",
41
+ "content": "Text=```neither 经理或员工 has been informed about the meeting```",
42
+ },
43
+ ]
44
+
45
+ input_ids = tokenizer.apply_chat_template(
46
+ messages, add_generation_prompt=True, return_tensors="pt"
47
+ ).to(model.device)
48
+
49
+ terminators = [tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<|end|>")]
50
+
51
+ outputs = model.generate(
52
+ input_ids,
53
+ max_new_tokens=256,
54
+ eos_token_id=terminators,
55
+ do_sample=True,
56
+ temperature=0.1,
57
+ )
58
+ response = outputs[0]
59
+ print(tokenizer.decode(response))
60
+
61
+ # <s><|user|> Please correct, polish, or translate the text delimited by triple backticks to standard English.<|end|><|assistant|>
62
+ # <|user|> Text=```neither 经理或员工 has been informed about the meeting```<|end|>
63
+ # <|assistant|> Output=Neither the manager nor the employee has been informed about the meeting.<|end|>
64
+ ```