初始化项目,由ModelHub XC社区提供模型
Model: bastienp/Gemma-2-2B-Instruct-structured-output Source: Original Platform
This commit is contained in:
40
.gitattributes
vendored
Normal file
40
.gitattributes
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
unsloth.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||||
78
README.md
Normal file
78
README.md
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
base_model: google/gemma-2-2b-it
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
license: gemma
|
||||||
|
tags:
|
||||||
|
- text-generation-inference
|
||||||
|
- transformers
|
||||||
|
- unsloth
|
||||||
|
- gemma2
|
||||||
|
datasets:
|
||||||
|
- paraloq/json_data_extraction
|
||||||
|
library_name: peft
|
||||||
|
---
|
||||||
|
|
||||||
|
# Gemma-2 2B Instruct fine-tuned on JSON dataset
|
||||||
|
|
||||||
|
This model is a Gemma-2 2b model fine-tuned to paraloq/json_data_extraction.
|
||||||
|
|
||||||
|
The model has been fine-tuned to extract data from a text according to a json schema.
|
||||||
|
## Prompt
|
||||||
|
|
||||||
|
The prompt used during training is:
|
||||||
|
```py
|
||||||
|
"""Below is a text paired with input that provides further context. Write JSON output that matches the schema to extract information.
|
||||||
|
|
||||||
|
### Input:
|
||||||
|
{input}
|
||||||
|
|
||||||
|
### Schema:
|
||||||
|
{schema}
|
||||||
|
|
||||||
|
### Response:
|
||||||
|
"""
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using the Model
|
||||||
|
|
||||||
|
You can use the model with the transformer library or with the wrapper from [unsloth] (https://unsloth.ai/blog/gemma2), which allows faster inference.
|
||||||
|
|
||||||
|
```py
|
||||||
|
import torch
|
||||||
|
from unsloth import FastLanguageModel
|
||||||
|
|
||||||
|
# Required to avoid cache size exceeded
|
||||||
|
torch._dynamo.config.accumulated_cache_size_limit = 2048
|
||||||
|
|
||||||
|
model, tokenizer = FastLanguageModel.from_pretrained(
|
||||||
|
model_name = f"bastienp/Gemma-2-2B-it-JSON-data-extration",
|
||||||
|
max_seq_length = 2048,
|
||||||
|
dtype = torch.float16,
|
||||||
|
load_in_4bit = False,
|
||||||
|
token = HF_TOKEN_READ,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Using the Quantized model (llama.cpp)
|
||||||
|
|
||||||
|
The model is supplied in GGFU format in 4bit and 8bit.
|
||||||
|
|
||||||
|
Example code with Llamacpp:
|
||||||
|
```py
|
||||||
|
from llama_cpp import Llama
|
||||||
|
|
||||||
|
llm = Llama.from_pretrained(
|
||||||
|
"bastienp/Gemma-2-2B-it-JSON-data-extration",
|
||||||
|
filename="*Q4_K_M.gguf", #*Q8_K_M.gguf for the 8 bit version
|
||||||
|
verbose=False,
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
The base model used for fine-tuning is google/gemma-2-2b-it. This repository is **NOT** affiliated with Google.
|
||||||
|
|
||||||
|
Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms.
|
||||||
|
|
||||||
|
- **Developed by:** bastienp
|
||||||
|
- **License:** gemma
|
||||||
|
- **Finetuned from model :** google/gemma-2-2b-it
|
||||||
31
adapter_config.json
Normal file
31
adapter_config.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"alpha_pattern": {},
|
||||||
|
"auto_mapping": null,
|
||||||
|
"base_model_name_or_path": "unsloth/gemma-2-2b-it",
|
||||||
|
"bias": "none",
|
||||||
|
"fan_in_fan_out": false,
|
||||||
|
"inference_mode": true,
|
||||||
|
"init_lora_weights": true,
|
||||||
|
"layer_replication": null,
|
||||||
|
"layers_pattern": null,
|
||||||
|
"layers_to_transform": null,
|
||||||
|
"loftq_config": {},
|
||||||
|
"lora_alpha": 16,
|
||||||
|
"lora_dropout": 0,
|
||||||
|
"megatron_config": null,
|
||||||
|
"megatron_core": "megatron.core",
|
||||||
|
"modules_to_save": null,
|
||||||
|
"peft_type": "LORA",
|
||||||
|
"r": 16,
|
||||||
|
"rank_pattern": {},
|
||||||
|
"revision": null,
|
||||||
|
"target_modules": [
|
||||||
|
"k_proj",
|
||||||
|
"v_proj",
|
||||||
|
"q_proj",
|
||||||
|
"o_proj"
|
||||||
|
],
|
||||||
|
"task_type": "CAUSAL_LM",
|
||||||
|
"use_dora": false,
|
||||||
|
"use_rslora": true
|
||||||
|
}
|
||||||
3
adapter_model.safetensors
Normal file
3
adapter_model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:67b7a94a247bf8e76c3be868e18903f58b2fc426452807914de41aad2f424fb0
|
||||||
|
size 25586896
|
||||||
3
config.json
Normal file
3
config.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"model_type": "gemma2"
|
||||||
|
}
|
||||||
34
special_tokens_map.json
Normal file
34
special_tokens_map.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<start_of_turn>",
|
||||||
|
"<end_of_turn>"
|
||||||
|
],
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<bos>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<eos>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "<pad>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3f289bc05132635a8bc7aca7aa21255efd5e18f3710f43e3cdb96bcd41be4922
|
||||||
|
size 17525357
|
||||||
3
tokenizer.model
Normal file
3
tokenizer.model
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:61a7b147390c64585d6c3543dd6fc636906c9af3865a5548f27f31aee1d4c8e2
|
||||||
|
size 4241003
|
||||||
2014
tokenizer_config.json
Normal file
2014
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
3
unsloth.F16.gguf
Normal file
3
unsloth.F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:11acb9f91e502dc0ac9d9c2b15b56603abf5d6d7ff73d29b35c0646ff77d6f49
|
||||||
|
size 5235213824
|
||||||
3
unsloth.Q4_K_M.gguf
Normal file
3
unsloth.Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b3f2514772816db14bacb9fa0c14e8ba793608e6d083b652735ab702fac4707b
|
||||||
|
size 1708582400
|
||||||
3
unsloth.Q5_K_M.gguf
Normal file
3
unsloth.Q5_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:a011f30f463d89f52a602367a4a1ba8a6465249551bd6797030198c0b5204571
|
||||||
|
size 1923278336
|
||||||
3
unsloth.Q8_0.gguf
Normal file
3
unsloth.Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:b521af3434cce9ca5320402505da9eb8b1cd3beb65de82a72f3c63f372f762ac
|
||||||
|
size 2784495104
|
||||||
Reference in New Issue
Block a user