| --- |
| language: |
| - en |
| license: apache-2.0 |
| tags: |
| - text-generation-inference |
| - transformers |
| - unsloth |
| - gemma |
| - trl |
| base_model: unsloth/gemma-2b-it-bnb-4bit |
| --- |
| ## SQuAD-it Evaluation |
|
|
| The Stanford Question Answering Dataset (SQuAD) in Italian (SQuAD-it) is used to evaluate the model's reading comprehension and question-answering capabilities. The following table presents the F1 score and Exact Match (EM) metrics: |
|
|
| | Model | F1 Score | Exact Match (EM) | |
| |----------------------------------------------|--------------|----------------------| |
| | **FinancialSupport/hellfire-2b** | **44.06%** | **26.27%** | |
|
|
| ## How to Use |
| How to use hellfire-2b |
|
|
| ```python |
| import os |
| from unsloth import FastLanguageModel |
| import torch |
| |
| os.environ['TOKENIZERS_PARALLELISM'] = 'TRUE' |
| |
| model, tokenizer = FastLanguageModel.from_pretrained( |
| model_name = "FinancialSupport/hellfire-2b", |
| max_seq_length = 10000, |
| dtype = torch.bfloat16, |
| load_in_4bit = True, |
| ) |
| FastLanguageModel.for_inference(model) # Enable native 2x faster inference |
| |
| alpaca_prompt = """ |
| Di seguito ti verrà fornito un contesto e poi una domanda. il tuo compito è quello di rispondere alla domanda basandoti esclusivamente sul contesto |
| ### Contesto: |
| {} |
| ### Domanda: |
| {} |
| ### Risposta: |
| {} |
| """ |
| |
| inputs = tokenizer( |
| [ |
| alpaca_prompt.format( |
| "La torre degli Asinelli è una delle cosiddette due torri di Bologna, simbolo della città, situate in piazza di porta Ravegnana, all'incrocio tra le antiche strade San Donato (ora via Zamboni), San Vitale, Maggiore e Castiglione. Eretta, secondo la tradizione, fra il 1109 e il 1119 dal nobile Gherardo Asinelli, la torre è alta 97,20 metri, pende verso ovest per 2,23 metri e presenta all'interno una scalinata composta da 498 gradini. Ancora non si può dire con certezza quando e da chi fu costruita la torre degli Asinelli. Si presume che la torre debba il proprio nome a Gherardo Asinelli, il nobile cavaliere di fazione ghibellina al quale se ne attribuisce la costruzione, iniziata secondo una consolidata tradizione l'11 ottobre 1109 e terminata dieci anni dopo, nel 1119.", # instruction |
| "Quale è alta la torre degli Asinelli?", # input |
| "", # output - leave this blank for generation! |
| ) |
| ], return_tensors = "pt").to("cuda") |
| |
| outputs = model.generate(**inputs, max_new_tokens = 64, use_cache = False) |
| print(tokenizer.batch_decode(outputs)) |
| ``` |
|
|
| # Uploaded model |
|
|
| - **Developed by:** FinancialSupport |
| - **License:** apache-2.0 |
| - **Finetuned from model :** unsloth/gemma-2b-it-bnb-4bit |
|
|
| This gemma model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library. |
|
|
| [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth) |
|
|