Downloads · 30 days
7
13% of all-time downloads
shijunju/gemma_2b_finRisk
gemma_2b_finRisk is a text generation model from shijunju. Use it when you need the model to write or continue text. It is set up for transformers.
This model is fine-tuned using the LoRA (Low-Rank Adaptation) approach, specifically designed for question answering in the domain of financial risk compliance.
Downloads · 30 days
7
13% of all-time downloads
All-time downloads
56
Public
Parameters
2.5B
30.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors5 GB · 99%
From the Hugging Face model README
This model is fine-tuned using the LoRA (Low-Rank Adaptation) approach, specifically designed for question answering in the domain of financial risk compliance.
The Gemma-2b-en model is fine-tuned using documents from fincen.gov.
It is capable of answering questions about documents published on fincen.gov, including Alerts, Advisories, and Financial Trend Analysis reports since 2020.
shijunju/fincen_all_questions_5versions
Use the code below to get started with the model. (Faster if using GPU.)
import torch
model_id = "shijunju/gemma_2b_finRisk"
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
token=os.environ['HF_TOKEN'])
tokenizer = AutoTokenizer.from_pretrained(model_id, token=os.environ['HF_TOKEN'])
# Function to generate responses
def generate_response(prompt, max_length=256):
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs,
temperature = 0.2,
max_length=max_length,
num_return_sequences=1)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
question = "Describe the increase in average monthly values of Real Estate Business Email Compromise incidents from 2020 to 2021."
inference_template = """<start_of_turn>user\nQuestion: {question}\n<end_of_turn>\n\n<start_of_turn>model\n"""
prompt = inference_template.format(
question=question,
response=""
)
print(generate_response(prompt))