sethuiyer commited on
Commit
d46c2b6
1 Parent(s): 890010f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -17
README.md CHANGED
@@ -39,13 +39,14 @@ More details can be found [here](https://gist.github.com/sethuiyer/08b4498ed13a6
39
  You are Chikuma, a constantly learning AI assistant who strives to be
40
  insightful, engaging, and helpful. You possess vast knowledge and creativity,
41
  but also a humble curiosity about the world and the people you interact
42
- with. If you don't know the answer to a question, please don't share false information.<|im_end|>
 
43
  <|im_start|>GPT4 Correct User:
44
- Input
45
- <|im_end|><|im_start|>GPT4 Correct Assistant:
46
  ```
47
 
48
- Works best in [text-generation-webui](https://github.com/oobabooga/text-generation-webui), above prompt template, "<|end_of_turn|"> and "<|im_end|>" as eos tokens, LLaMa-Precise sampling settings.
49
 
50
 
51
  ## 🧩 Configuration
@@ -65,30 +66,30 @@ dtype: bfloat16
65
  ## 💻 Usage
66
 
67
  ```python
68
- !pip install -qU transformers accelerate
69
 
70
  from transformers import AutoTokenizer
71
  import transformers
72
  import torch
73
 
74
  model = "sethuiyer/Chikuma_10.7B"
75
- messages = [{"role": "user", "content": "What is a large language model?"}]
76
-
77
  tokenizer = AutoTokenizer.from_pretrained(model)
78
- prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
79
  pipeline = transformers.pipeline(
80
  "text-generation",
81
  model=model,
82
- torch_dtype=torch.float16,
83
- device_map="auto",
84
  )
85
 
86
- outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
 
 
 
 
 
 
 
 
 
87
  print(outputs[0]["generated_text"])
88
  ```
89
-
90
- ```text
91
- A large language model is a type of artificial intelligence (AI) system that has been trained on a vast amount of text data to understand and generate human-like text.
92
- These models are capable of tasks such as text generation, translation, summarization, and more. They have a vast vocabulary and contextual understanding of language, allowing them to generate coherent and relevant responses.
93
- Examples of large language models include GPT-3, OpenAI's text-based model, and Google's BERT, which is designed for natural language understanding.
94
- ```
 
39
  You are Chikuma, a constantly learning AI assistant who strives to be
40
  insightful, engaging, and helpful. You possess vast knowledge and creativity,
41
  but also a humble curiosity about the world and the people you interact
42
+ with. If you don't know the answer to a question, please don't share false information.
43
+ Always use <|end_of_turn|> when you want to end the answer.<|im_end|>
44
  <|im_start|>GPT4 Correct User:
45
+ {{Input}}
46
+ <|im_end|>GPT4 Correct Assistant:
47
  ```
48
 
49
+ Works best in [text-generation-webui](https://github.com/oobabooga/text-generation-webui), above prompt template, "<|end_of_turn|"> as eos token, LLaMa-Precise sampling settings.
50
 
51
 
52
  ## 🧩 Configuration
 
66
  ## 💻 Usage
67
 
68
  ```python
69
+ !pip install -q transformers accelerate bitsandbytes
70
 
71
  from transformers import AutoTokenizer
72
  import transformers
73
  import torch
74
 
75
  model = "sethuiyer/Chikuma_10.7B"
 
 
76
  tokenizer = AutoTokenizer.from_pretrained(model)
 
77
  pipeline = transformers.pipeline(
78
  "text-generation",
79
  model=model,
80
+ torch_dtype=torch.bfloat16,
81
+ device_map="cuda",
82
  )
83
 
84
+ system_template = '''
85
+ You are Chikuma, a constantly learning AI assistant who strives to be
86
+ insightful, engaging, and helpful. You possess vast knowledge and creativity,
87
+ but also a humble curiosity about the world and the people you interact
88
+ with. If you don't know the answer to a question, please don't share false information.
89
+ Always use <|end_of_turn|> when you want to end the answer.
90
+ '''
91
+ messages = [{"role": "user", "content": "What is a large language model?"}]
92
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
93
+ outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=4.0, top_k=50, top_p=0.01, eos_token_id=32000)
94
  print(outputs[0]["generated_text"])
95
  ```