Update README.md
Browse files
README.md
CHANGED
|
@@ -15,11 +15,10 @@ pipeline_tag: text-generation
|
|
| 15 |
|
| 16 |
# Gemma-2 2B Instruct fine-tuned on JSON dataset
|
| 17 |
|
| 18 |
-
This model is a Gemma-2 2b model
|
| 19 |
|
| 20 |
-
The model
|
| 21 |
-
|
| 22 |
-
# Prompt
|
| 23 |
|
| 24 |
The prompt used during training is:
|
| 25 |
```py
|
|
@@ -35,6 +34,44 @@ The prompt used during training is:
|
|
| 35 |
"""
|
| 36 |
```
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
- **Developed by:** bastienp
|
| 39 |
- **License:** gemma
|
| 40 |
- **Finetuned from model :** unsloth/gemma-2-2b-it
|
|
|
|
| 15 |
|
| 16 |
# Gemma-2 2B Instruct fine-tuned on JSON dataset
|
| 17 |
|
| 18 |
+
This model is a Gemma-2 2b model fine-tuned to paraloq/json_data_extraction.
|
| 19 |
|
| 20 |
+
The model has been fine-tuned to extract data from a text according to a json schema.
|
| 21 |
+
## Prompt
|
|
|
|
| 22 |
|
| 23 |
The prompt used during training is:
|
| 24 |
```py
|
|
|
|
| 34 |
"""
|
| 35 |
```
|
| 36 |
|
| 37 |
+
## Using the Model
|
| 38 |
+
|
| 39 |
+
You can use the model with the transformer library or with the wrapper from [unsloth] (https://unsloth.ai/blog/gemma2), which allows faster inference.
|
| 40 |
+
|
| 41 |
+
```py
|
| 42 |
+
import torch
|
| 43 |
+
from unsloth import FastLanguageModel
|
| 44 |
+
|
| 45 |
+
# Required to avoid cache size exceeded
|
| 46 |
+
torch._dynamo.config.accumulated_cache_size_limit = 2048
|
| 47 |
+
|
| 48 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 49 |
+
model_name = f"bastienp/Gemma-2-2B-it-JSON-data-extration",
|
| 50 |
+
max_seq_length = 2048,
|
| 51 |
+
dtype = torch.float16,
|
| 52 |
+
load_in_4bit = False,
|
| 53 |
+
token = HF_TOKEN_READ,
|
| 54 |
+
)
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Using the Quantized model (llama.cpp)
|
| 58 |
+
|
| 59 |
+
The model is supplied in GGFU format in 4bit and 8bit.
|
| 60 |
+
|
| 61 |
+
Example code with Llamacpp:
|
| 62 |
+
```py
|
| 63 |
+
from llama_cpp import Llama
|
| 64 |
+
|
| 65 |
+
llm = Llama.from_pretrained(
|
| 66 |
+
"bastienp/Gemma-2-2B-it-JSON-data-extration",
|
| 67 |
+
filename="*Q4_K_M.gguf", #*Q8_K_M.gguf for the 8 bit version
|
| 68 |
+
verbose=False,
|
| 69 |
+
)
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Thanks to the google team that provided gemma-2, this model follows the gemma licence, please check it out if you want to use this repository.
|
| 73 |
+
|
| 74 |
+
|
| 75 |
- **Developed by:** bastienp
|
| 76 |
- **License:** gemma
|
| 77 |
- **Finetuned from model :** unsloth/gemma-2-2b-it
|