date3k2 commited on
Commit
654a623
·
verified ·
1 Parent(s): 8cade22

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -10
README.md CHANGED
@@ -38,14 +38,12 @@ import torch
38
  model_name = "mistralai/Mistral-7B-Instruct-v0.3"
39
  peft_model_id = "date3k2/mistral-v0.3-alpaca-vi-v1"
40
 
41
- bnb_config = BitsAndBytesConfig(
42
- load_in_8bit= True
43
- )
44
  model = AutoModelForCausalLM.from_pretrained(
45
- model_name,
46
- quantization_config=bnb_config,
47
- device_map="auto",
48
- trust_remote_code=True,
49
  )
50
  tokenizer = AutoTokenizer.from_pretrained(model_name)
51
 
@@ -54,9 +52,12 @@ model.load_adapter(peft_model_id)
54
  device = "cuda"
55
 
56
  messages = [
57
- {"role": "user", "content": "Bạn là ai?"},
58
- {"role": "assistant", "content": "Tôi là Dastral, một trợ lý AI đắc lực"},
59
- {"role": "user", "content": "Viết công thức để nấu một món ngon từ thịt bò."}
 
 
 
60
  ]
61
 
62
  encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
@@ -66,6 +67,7 @@ model_inputs = encodeds.to(device)
66
  generated_ids = model.generate(model_inputs, max_new_tokens=500, do_sample=True)
67
  decoded = tokenizer.batch_decode(generated_ids)
68
  print(decoded[0])
 
69
  ```
70
 
71
  The following hyperparameters were used during training:
 
38
  model_name = "mistralai/Mistral-7B-Instruct-v0.3"
39
  peft_model_id = "date3k2/mistral-v0.3-alpaca-vi-v1"
40
 
41
+ bnb_config = BitsAndBytesConfig(load_in_8bit=True)
 
 
42
  model = AutoModelForCausalLM.from_pretrained(
43
+ model_name,
44
+ quantization_config=bnb_config,
45
+ device_map="auto",
46
+ trust_remote_code=True,
47
  )
48
  tokenizer = AutoTokenizer.from_pretrained(model_name)
49
 
 
52
  device = "cuda"
53
 
54
  messages = [
55
+ {
56
+ "role": "user",
57
+ "content": """You are a helpful Vietnamese AI chatbot. Below is an instruction that describes a task. Write a response that appropriately completes the request. Your response should be in Vietnamese.
58
+ Instruction:
59
+ Viết công thức để nấu một món ngon từ thịt bò.""",
60
+ },
61
  ]
62
 
63
  encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
 
67
  generated_ids = model.generate(model_inputs, max_new_tokens=500, do_sample=True)
68
  decoded = tokenizer.batch_decode(generated_ids)
69
  print(decoded[0])
70
+
71
  ```
72
 
73
  The following hyperparameters were used during training: