Views
No views yet
[INST] and [/INST] tokens. The very first instruction should begin with a begin of sentence id. The next instructions should not. The assistant generation will be ended by the end-of-sentence token id.text = "<s>[INST] 아이작 뉴턴의 업적을 알려줘. [/INST]"1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3device = "cuda" # the device to load the model onto
4
5model = AutoModelForCausalLM.from_pretrained("maywell/Synatra-V0.1-7B")
6tokenizer = AutoTokenizer.from_pretrained("maywell/Synatra-V0.1-7B")
7
8messages = [
9 {"role": "user", "content": "What is your favourite condiment?"},
10]
11
12encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
13
14model_inputs = encodeds.to(device)
15model.to(device)
16
17generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
18decoded = tokenizer.batch_decode(generated_ids)
19print(decoded[0])[INST] 링컨에 대해서 알려줘. [/INST]Readme format: beomi/llama-2-ko-7b