jphme commited on
Commit
ccad403
1 Parent(s): 6139188

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +94 -0
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ library_name: transformers
5
+ pipeline_tag: text-generation
6
+ inference: true
7
+ tags:
8
+ - pytorch
9
+ - phi
10
+ - phi-1_5
11
+ - english
12
+ datasets:
13
+ - ehartford/wizard_vicuna_70k_unfiltered
14
+ ---
15
+ # Phi 1.5 Wizard Vicuna Experimental
16
+
17
+ Experimental Finetune on Microsoft's [Phi 1.5](https://huggingface.co/microsoft/phi-1_5).
18
+ This is highly experimental, only trained on a subset of the 70k Wizard Vicuna dataset and not meant for production use.
19
+
20
+ This model also runs reasonably fast on CPU!
21
+
22
+ Will update with later checkpoints later.
23
+
24
+ # Prompt Format
25
+
26
+ ShareGPT / Vicuna (without newlines):
27
+ ```
28
+ A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: This is a question? ASSISTANT: Here is my answer"
29
+ ```
30
+
31
+ # Code Example
32
+
33
+ ```python
34
+ import torch
35
+ from transformers import AutoModelForCausalLM, AutoTokenizer
36
+
37
+ model = AutoModelForCausalLM.from_pretrained("jphme/phi-1_5_wizzard_vicuna_uncensored", trust_remote_code=True, torch_dtype=torch.bfloat16).to("cuda")
38
+ tokenizer = AutoTokenizer.from_pretrained("jphme/phi-1_5_wizzard_vicuna_uncensored", trust_remote_code=True, torch_dtype=torch.bfloat16)
39
+ prompt_template=("A chat between a curious user and an artificial intelligence assistant. "
40
+ "The assistant gives helpful, detailed, and polite answers to the user's questions. "
41
+ "USER: {prompt} ASSISTANT:")
42
+
43
+ inputs = tokenizer(
44
+ prompt_template.format(prompt="What is 1+1?"),
45
+ return_tensors="pt", return_attention_mask=False).to('cuda')
46
+ outputs = model_wiz.generate(
47
+ **inputs, max_length=200,
48
+ do_sample=True,
49
+ temperature=0.5,
50
+ top_p=0.95,
51
+ use_cache=True,
52
+ repetition_penalty=1.1,
53
+ #can try to uncomment this if model doesn't end
54
+ #eos_token_id=tokenizer.eos_token_id
55
+ )
56
+ text = tokenizer.batch_decode(outputs,skip_special_tokens=True)[0]
57
+ print(text)
58
+ ```
59
+
60
+ The model doesn't stop by itself (this could be an issue due to eos/bos tokens being identical), so you can try to explicitly set the `eos_token_id` (see above) or use a custom stopping criteria.
61
+
62
+ You can remove `.to("cuda")` to let the model run without a GPU!
63
+
64
+ # Examples
65
+
66
+ > A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: Who was president of the USA in 1995? ASSISTANT: The president of the United States at that time was Bill Clinton (...)
67
+
68
+
69
+ > A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: Write a python function that returns the fibonacci sequence ASSISTANT:The Fibonacci sequence is a series of numbers where each number after the first two are obtained by adding the two preceding ones together (starting from 0). So the sequence goes 0, 1, 1, 2, 3, 5, 8, 13, 21...
70
+ Here's a Python function that generates the nth term in the Fibonacci sequence:
71
+ ```python
72
+ def fibonacci(n):
73
+ if n <= 1:
74
+ return n
75
+ else:
76
+ f = [0,1]
77
+ for i in range(2, n+1):
78
+ f.append(f[-1]+f[-2])
79
+ return f[-1]
80
+ ```
81
+ > This function takes as input `n`, which represents the (...)
82
+ (this function works with corrected intendation)
83
+
84
+ > A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: What is (500+12)/4? ASSISTANT:The answer to this expression is 7.5. (...)
85
+ Some potential here ;-)...
86
+
87
+ # Thanks
88
+
89
+ Thanks to Microsoft for releaseing Phi 1.5, [Eric Hartford](https://huggingface.co/ehartford) for releasing the Wizard Vicuna dataset, [Winglian](https://huggingface.co/winglian) for his great work on Axolotl that I use for finetuning and [Teknium](https://huggingface.co/teknium) for some Phi finetuning discussion.
90
+
91
+
92
+ # License
93
+
94
+ The original licenses of the dataset and model applies. No warranty whatsoever, this model is only intended for research purposes.