Model Card for shijunju/gemma_2b_finRisk

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.

Model Details

Model Description

  • The model is created as part of experiment to find better models, a more accurate (70%-78%) finetuned model can be found at: shijunju/gemma_7b_finRisk_r6_4VersionQ
  • Developed by: Shijun Ju
  • Finetuned from model: Gemma-2b-en
  • QLoRA rank: 6

Dataset Used

shijunju/fincen_all_questions_5versions

How to Get Started with the Model

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))

Model Card Contact

shijunju@hotmail.com

Downloads last month
15
Safetensors
Model size
2.51B params
Tensor type
FP16
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for shijunju/gemma_2b_finRisk

Quantizations
1 model