Downloads · 30 days
5
20% of all-time downloads
DamnOnic/efu-general-demo
efu-general-demo is a machine learning model from DamnOnic. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as llama2.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
5
20% of all-time downloads
All-time downloads
25
Public
Repo size
101 MB
Likes
0
Public
Click a slice to open those files.
.safetensors16.8 MB · 80%
From the Hugging Face model README
This model is a fine-tuned version of meta-llama/Llama-2-7b-hf on an unknown dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
This model is a LoRA fine-tuned adapter for EFU General Insurance Q&A.
It must be loaded on top of the base LLaMA model.
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Base model
base_model = "meta-llama/Llama-2-7b-hf"
# LoRA adapter (this repo)
adapter_model = "DamnOnic/efu-general-demo"
# Load tokenizer and base model
tokenizer = AutoTokenizer.from_pretrained(base_model)
base = AutoModelForCausalLM.from_pretrained(base_model, device_map="auto", load_in_8bit=True)
# Load fine-tuned adapter
model = PeftModel.from_pretrained(base, adapter_model)
# Ask questions
def ask(question, max_new_tokens=200):
prompt = f"### Instruction: {question}\n\n### Input:\n\n### Response:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=max_new_tokens, temperature=0.7, top_p=0.9)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
print(ask("What is EFU General Insurance?"))