mirror of
https://github.com/deepseek-ai/DeepSeek-LLM
synced 2025-01-22 10:36:03 +00:00
Update README.md (#39)
This commit is contained in:
parent
4745a5e5d5
commit
6712a86bfb
@ -317,10 +317,11 @@ messages_list = [
|
||||
[{"role": "user", "content": "What can you do?"}],
|
||||
[{"role": "user", "content": "Explain Transformer briefly."}],
|
||||
]
|
||||
prompts = [tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False) for messages in messages_list]
|
||||
# Avoid adding bos_token repeatedly
|
||||
prompt_token_ids = [tokenizer.apply_chat_template(messages, add_generation_prompt=True) for messages in messages_list]
|
||||
|
||||
sampling_params.stop = [tokenizer.eos_token]
|
||||
outputs = llm.generate(prompts, sampling_params)
|
||||
outputs = llm.generate(prompt_token_ids=prompt_token_ids, sampling_params=sampling_params)
|
||||
|
||||
generated_text = [output.outputs[0].text for output in outputs]
|
||||
print(generated_text)
|
||||
|
Loading…
Reference in New Issue
Block a user