Views
No views yet
1# Format prompt
2message = [
3 {"role": "system", "content": "You are a helpful assistant chatbot."},
4 {"role": "user", "content": "What is a Large Language Model?"}
5]
6tokenizer = AutoTokenizer.from_pretrained(new_model)
7prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
8
9# Create pipeline
10pipeline = transformers.pipeline(
11 "text-generation",
12 model=new_model,
13 tokenizer=tokenizer
14)
15
16# Generate text
17sequences = pipeline(
18 prompt,
19 do_sample=True,
20 temperature=0.7,
21 top_p=0.9,
22 num_return_sequences=1,
23 max_length=200,
24)
25print(sequences[0]['generated_text'])
26# <|system|>
27# You are a helpful assistant chatbot.</s>
28# <|user|>
29# What is a Large Language Model?</s>
30# <|assistant|>
31# A Large Language Model (LLM) is a type of deep learning model that processes large amounts of text or data to improve the accuracy of natural language processing tasks such as sentiment analysis, machine translation, and question answering. LLMs are trained using large datasets, which allow them to generalize better and have better performance compared to traditional machine learning models. They are capable of handling vast amounts of text and can learn complex relationships between words, phrases, and sentences, making them an essential tool for natural language processing.| Tasks | Metric | Value | Stderr | |
|---|---|---|---|---|
| arc_challenge | acc | 0.3003 | ± | 0.0134 |
| acc_norm | 0.3276 | ± | 0.0137 | |
| arc_easy | acc | 0.6115 | ± | 0.0100 |
| acc_norm | 0.5354 | ± | 0.0102 | |
| boolq | acc | 0.6147 | ± | 0.0085 |
| hellaswag | acc | 0.4633 | ± | 0.0050 |
| acc_norm | 0.6033 | ± | 0.0049 | |
| openbookqa | acc | 0.2480 | ± | 0.0193 |
| acc_norm | 0.3720 | ± | 0.0216 | |
| piqa | acc | 0.7470 | ± | 0.0101 |
| acc_norm | 0.7470 | ± | 0.0101 | |
| winogrande | acc | 0.6054 | ± | 0.0137 |