Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| mistral-indo-7b.Q2_K.gguf | Q2_K | 2.53GB |
| mistral-indo-7b.IQ3_XS.gguf | IQ3_XS | 2.81GB |
| mistral-indo-7b.IQ3_S.gguf | IQ3_S | 2.96GB |
| mistral-indo-7b.Q3_K_S.gguf | Q3_K_S | 2.95GB |
| mistral-indo-7b.IQ3_M.gguf | IQ3_M | 3.06GB |
| mistral-indo-7b.Q3_K.gguf | Q3_K | 3.28GB |
| mistral-indo-7b.Q3_K_M.gguf | Q3_K_M | 3.28GB |
| mistral-indo-7b.Q3_K_L.gguf | Q3_K_L | 3.56GB |
| mistral-indo-7b.IQ4_XS.gguf | IQ4_XS | 3.67GB |
| mistral-indo-7b.Q4_0.gguf | Q4_0 | 3.83GB |
| mistral-indo-7b.IQ4_NL.gguf | IQ4_NL | 3.87GB |
| mistral-indo-7b.Q4_K_S.gguf | Q4_K_S | 3.86GB |
| mistral-indo-7b.Q4_K.gguf | Q4_K | 4.07GB |
| mistral-indo-7b.Q4_K_M.gguf | Q4_K_M | 4.07GB |
| mistral-indo-7b.Q4_1.gguf | Q4_1 | 4.24GB |
| mistral-indo-7b.Q5_0.gguf | Q5_0 | 4.65GB |
| mistral-indo-7b.Q5_K_S.gguf | Q5_K_S | 4.65GB |
| mistral-indo-7b.Q5_K.gguf | Q5_K | 4.78GB |
| mistral-indo-7b.Q5_K_M.gguf | Q5_K_M | 4.78GB |
| mistral-indo-7b.Q5_1.gguf | Q5_1 | 5.07GB |
| mistral-indo-7b.Q6_K.gguf | Q6_K | 5.53GB |
| mistral-indo-7b.Q8_0.gguf | Q8_0 | 7.17GB |
### Human: {Instruction}### Assistant: {response}import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoTokenizer, GenerationConfig
model_id = "sarahlintang/mistral-indo-7b"
model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True).to("cuda")
tokenizer = AutoTokenizer.from_pretrained(model_id)
def create_instruction(instruction):
prompt = f"### Human: {instruction} ### Assistant: "
return prompt
def generate(
instruction,
max_new_tokens=128,
temperature=0.1,
top_p=0.75,
top_k=40,
num_beams=4,
**kwargs
):
prompt = create_instruction(instruction)
inputs = tokenizer(prompt, return_tensors="pt")
input_ids = inputs["input_ids"].to("cuda")
attention_mask = inputs["attention_mask"].to("cuda")
generation_config = GenerationConfig(
temperature=temperature,
top_p=top_p,
top_k=top_k,
num_beams=num_beams,
**kwargs,
)
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
attention_mask=attention_mask,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=max_new_tokens,
early_stopping=True
)
s = generation_output.sequences[0]
output = tokenizer.decode(s)
return output.split("### Assistant:")[1].strip()
instruction = "Sebutkan lima macam makanan khas Indonesia."
print(generate(instruction))