Views
No views yet
| Dataset | Version | Metric | Mode | Sailor_4b | Bahasa-4b-hf | Mistral-7B-v0.1 |
|---|---|---|---|---|---|---|
| tydiqa-id | 0e9309 | EM | gen | 53.98 | 55.04 | 63.54 |
| tydiqa-id | 0e9309 | F1 | gen | 73.48 | 75.39 | 78.73 |
| xcopa-id | 36c11c | EM | ppl | 69.2 | 73.2 | 62.40 |
| xcopa-id | 36c11c | F1 | ppl | 69.2 | 73.2 | - |
| m3exam-id-ppl | ede415 | EM | ppl | 31.27 | 44.47 | 26.68 |
| belebele-id-ppl | 7fe030 | EM | ppl | 41.33 | 42.33 | 41.33 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2device = "cuda" # the device to load the model onto
3
4model = AutoModelForCausalLM.from_pretrained(
5 "Bahasalab/Bahasa-4b-chat-v2",
6 torch_dtype="auto",
7 device_map="auto"
8)
9tokenizer = AutoTokenizer.from_pretrained("Bahasalab/Bahasa-4b-chat")
10
11messages = [
12 {"role": "system", "content": "Kamu adalah asisten yang membantu"},
13 {"role": "user", "content": "kamu siapa"}
14]
15text = tokenizer.apply_chat_template(
16 messages,
17 tokenize=False,
18 add_generation_prompt=True
19)
20
21model_inputs = tokenizer([text], return_tensors="pt").to(device)
22
23generated_ids = model.generate(
24 input_ids=model_inputs.input_ids,
25 attention_mask=model_inputs.attention_mask,
26 max_new_tokens=512,
27 eos_token_id=tokenizer.eos_token_id
28
29)
30generated_ids = [
31 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
32]
33
34response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
35print(response)