Xenova HF staff commited on
Commit
59d179b
1 Parent(s): 0cf120d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -20,10 +20,10 @@ import { pipeline } from '@xenova/transformers';
20
  const generator = await pipeline('text-generation', 'Xenova/Qwen1.5-0.5B-Chat');
21
 
22
  // Define the prompt and list of messages
23
- const prompt = "Give me a short introduction to large language model."
24
  const messages = [
25
- { "role": "system", "content": "You are a helpful assistant." },
26
- { "role": "user", "content": prompt }
27
  ]
28
 
29
  // Apply chat template
@@ -36,6 +36,7 @@ const text = generator.tokenizer.apply_chat_template(messages, {
36
  const output = await generator(text, {
37
  max_new_tokens: 128,
38
  do_sample: false,
 
39
  });
40
  console.log(output[0].generated_text);
41
  // 'A large language model is a type of artificial intelligence system that can generate text based on the input provided by users, such as books, articles, or websites. It uses advanced algorithms and techniques to learn from vast amounts of data and improve its performance over time through machine learning and natural language processing (NLP). Large language models have become increasingly popular in recent years due to their ability to handle complex tasks such as generating human-like text quickly and accurately. They have also been used in various fields such as customer service chatbots, virtual assistants, and search engines for information retrieval purposes.'
 
20
  const generator = await pipeline('text-generation', 'Xenova/Qwen1.5-0.5B-Chat');
21
 
22
  // Define the prompt and list of messages
23
+ const prompt = 'Give me a short introduction to large language model.'
24
  const messages = [
25
+ { role: 'system', content: 'You are a helpful assistant.' },
26
+ { role: 'user', content: prompt }
27
  ]
28
 
29
  // Apply chat template
 
36
  const output = await generator(text, {
37
  max_new_tokens: 128,
38
  do_sample: false,
39
+ return_full_text: false,
40
  });
41
  console.log(output[0].generated_text);
42
  // 'A large language model is a type of artificial intelligence system that can generate text based on the input provided by users, such as books, articles, or websites. It uses advanced algorithms and techniques to learn from vast amounts of data and improve its performance over time through machine learning and natural language processing (NLP). Large language models have become increasingly popular in recent years due to their ability to handle complex tasks such as generating human-like text quickly and accurately. They have also been used in various fields such as customer service chatbots, virtual assistants, and search engines for information retrieval purposes.'