Views
No views yet
q4_0, q4_1, q5_0, q5_1, q8_0q2_K, q3_K_S, q3_K_M, q3_K_L, q4_K_S, q4_K_M, q5_K_S, q6_K2d43387.| Name | Quant method | Bits | Use case |
|---|---|---|---|
| Merak-7B-v2.ggmlv3.q2_K.bin | q2_K | 2 | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.vw and feed_forward.w2 tensors, GGML_TYPE_Q2_K for the other tensors. |
| Merak-7B-v2.ggmlv3.q3_K_L.bin | q3_K_L | 3 | New k-quant method. Uses GGML_TYPE_Q5_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
| Merak-7B-v2.ggmlv3.q3_K_M.bin | q3_K_M | 3 | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
| Merak-7B-v2.ggmlv3.q3_K_S.bin | q3_K_S | 3 | New k-quant method. Uses GGML_TYPE_Q3_K for all tensors |
| Merak-7B-v2.ggmlv3.q4_0.bin | q4_0 | 4 | Original quant method, 4-bit. |
| Merak-7B-v2.ggmlv3.q4_1.bin | q4_1 | 4 | Original quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
| Merak-7B-v2.ggmlv3.q4_K_M.bin | q4_K_M | 4 | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q4_K |
| Merak-7B-v2.ggmlv3.q4_K_S.bin | q4_K_S | 4 | New k-quant method. Uses GGML_TYPE_Q4_K for all tensors |
| Merak-7B-v2.ggmlv3.q5_0.bin | q5_0 | 5 | Original quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. |
| Merak-7B-v2.ggmlv3.q5_1.bin | q5_1 | 5 | Original quant method, 5-bit. Even higher accuracy, resource usage and slower inference. |
| Merak-7B-v2.ggmlv3.q5_K_M.bin | q5_K_M | 5 | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q5_K |
| Merak-7B-v2.ggmlv3.q5_K_S.bin | q5_K_S | 5 | New k-quant method. Uses GGML_TYPE_Q5_K for all tensors |
| Merak-7B-v2.ggmlv3.q6_K.bin | q6_K | 6 | New k-quant method. Uses GGML_TYPE_Q8_K for all tensors - 6-bit quantization |
| lMerak-7B-v2.ggmlv3.q8_0.bin | q8_0 | 8 | Original quant method, 8-bit. Almost indistinguishable from float16. High resource use and slow. Not recommended for most users. |
text-generation-webuipip install bitsandbytes==0.39.1
pip install transformers==4.31.0
pip install peft==0.4.0
pip install accelerate==0.20.3
pip install einops==0.6.1 scipy sentencepiece datasetsimport torch
from transformers import AutoTokenizer, AutoConfig, AutoModelForCausalLM, BitsAndBytesConfig, LlamaTokenizer
from peft import PeftModel, PeftConfig
model_id = "Ichsan2895/Merak-7B-v2"
config = AutoConfig.from_pretrained(model_id)
BNB_CONFIG = BitsAndBytesConfig(load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
model = AutoModelForCausalLM.from_pretrained(model_id,
quantization_config=BNB_CONFIG,
device_map="auto",
trust_remote_code=True)
tokenizer = LlamaTokenizer.from_pretrained(model_id)
def generate_response(question: str) -> str:
prompt = f"<|prompt|>{question}\n<|answer|>".strip()
encoding = tokenizer(prompt, return_tensors='pt').to("cuda")
with torch.inference_mode():
outputs = model.generate(input_ids=encoding.input_ids,
attention_mask=encoding.attention_mask,
eos_token_id=tokenizer.pad_token_id,
do_sample=False,
num_beams=2,
temperature=0.3,
repetition_penalty=1.2,
max_length=200)
response = tokenizer.decode(outputs[0], skip_special_tokes=True)
assistant_start = "<|answer|>"
response_start = response.find(assistant_start)
return response[response_start + len(assistant_start) :].strip()
prompt = "Siapa penulis naskah proklamasi kemerdekaan Indonesia?"
print(generate_response(prompt))import torch
from transformers import AutoTokenizer, AutoConfig, AutoModelForCausalLM, BitsAndBytesConfig, LlamaTokenizer
from peft import PeftModel, PeftConfig
model_id = "Ichsan2895/Merak-7B-v2"
config = AutoConfig.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id,
device_map="auto",
trust_remote_code=True)
tokenizer = LlamaTokenizer.from_pretrained(model_id)
def generate_response(question: str) -> str:
prompt = f"<|prompt|>{question}\n<|answer|>".strip()
encoding = tokenizer(prompt, return_tensors='pt').to("cuda")
with torch.inference_mode():
outputs = model.generate(input_ids=encoding.input_ids,
attention_mask=encoding.attention_mask,
eos_token_id=tokenizer.pad_token_id,
do_sample=False,
num_beams=2,
temperature=0.3,
repetition_penalty=1.2,
max_length=200)
response = tokenizer.decode(outputs[0], skip_special_tokes=True)
assistant_start = "<|answer|>"
response_start = response.find(assistant_start)
return response[response_start + len(assistant_start) :].strip()
prompt = "Siapa penulis naskah proklamasi kemerdekaan Indonesia?"
print(generate_response(prompt))@Paper{arXiv,
author = {Touvron, et al},
title = {Llama 2: Open Foundation and Fine-Tuned Chat Models},
journal = {arXiv preprint arXiv:2307.09288},
year = {2023}
}
@ONLINE{wikidump,
author = "Wikimedia Foundation",
title = "Wikimedia Downloads",
url = "https://dumps.wikimedia.org"
}
@inproceedings{wolf-etal-2020-transformers,
title = "Transformers: State-of-the-Art Natural Language Processing",
author = "Thomas Wolf and Lysandre Debut and Victor Sanh and Julien Chaumond and Clement Delangue and Anthony Moi and Pierric Cistac and Tim Rault and Rémi Louf and Morgan Funtowicz and Joe Davison and Sam Shleifer and Patrick von Platen and Clara Ma and Yacine Jernite and Julien Plu and Canwen Xu and Teven Le Scao and Sylvain Gugger and Mariama Drame and Quentin Lhoest and Alexander M. Rush",
booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
month = oct,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
url = "https://www.aclweb.org/anthology/2020.emnlp-demos.6",
pages = "38--45"
}
@article{dettmers2023qlora,
title = {QLoRA: Efficient Finetuning of Quantized LLMs},
author = {Dettmers, Tim and Pagnoni, Artidoro and Holtzman, Ari and Zettlemoyer, Luke},
journal = {arXiv preprint arXiv:2305.14314},
year = {2023}
}