first commit
This commit is contained in:
parent
0e25a5fb8d
commit
4b6317798c
Binary file not shown.
After Width: | Height: | Size: 173 KiB |
Binary file not shown.
After Width: | Height: | Size: 146 KiB |
189
README.md
189
README.md
|
@ -1,3 +1,188 @@
|
||||||
# NuExtract-1.5_a13714748337156096101495
|
---
|
||||||
|
license: mit
|
||||||
|
language:
|
||||||
|
- multilingual
|
||||||
|
tags:
|
||||||
|
- nlp
|
||||||
|
base_model: microsoft/Phi-3.5-mini-instruct
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
inference: true
|
||||||
|
---
|
||||||
|
|
||||||
NuExtract-1.5
|
# NuExtract-v1.5 by NuMind 🔥
|
||||||
|
|
||||||
|
NuExtract-v1.5 is a fine-tuning of [Phi-3.5-mini-instruct](https://huggingface.co/microsoft/Phi-3.5-mini-instruct), trained on a private high-quality dataset for structured information extraction. It supports long documents and several languages (English, French, Spanish, German, Portuguese, and Italian).
|
||||||
|
To use the model, provide an input text and a JSON template describing the information you need to extract.
|
||||||
|
|
||||||
|
Note: This model is trained to prioritize pure extraction, so in most cases all text generated by the model is present as is in the original text.
|
||||||
|
|
||||||
|
Check out the [blog post](https://numind.ai/blog/nuextract-1-5---multilingual-infinite-context-still-small-and-better-than-gpt-4o).
|
||||||
|
|
||||||
|
Try it here: [Playground](https://huggingface.co/spaces/numind/NuExtract-v1.5)
|
||||||
|
|
||||||
|
We also provide a tiny (0.5B) version which is based on Qwen2.5-0.5B: [NuExtract-tiny-v1.5](https://huggingface.co/numind/NuExtract-tiny-v1.5)
|
||||||
|
|
||||||
|
⚠️ We recommend using NuExtract with a temperature at or very close to 0. Some inference frameworks, such as Ollama, use a default of 0.7 which is not well suited to pure extraction tasks.
|
||||||
|
|
||||||
|
## Benchmark
|
||||||
|
|
||||||
|
Zero-shot performance (English):
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="english_bench.png" style="height: auto;">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Zero-shot performance (Multilingual):
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="multilingual_bench.png" style="height: auto;">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Long documents (8-10k tokens):
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="8-10_long_context.png" style="height: auto;">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Very long documents (10-20k tokens):
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="10-20_long_context.png" style="height: auto;">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Few-shot fine-tuning:
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="fewshot_bench.png" style="height: auto;">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To use the model:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import json
|
||||||
|
import torch
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
def predict_NuExtract(model, tokenizer, texts, template, batch_size=1, max_length=10_000, max_new_tokens=4_000):
|
||||||
|
template = json.dumps(json.loads(template), indent=4)
|
||||||
|
prompts = [f"""<|input|>\n### Template:\n{template}\n### Text:\n{text}\n\n<|output|>""" for text in texts]
|
||||||
|
|
||||||
|
outputs = []
|
||||||
|
with torch.no_grad():
|
||||||
|
for i in range(0, len(prompts), batch_size):
|
||||||
|
batch_prompts = prompts[i:i+batch_size]
|
||||||
|
batch_encodings = tokenizer(batch_prompts, return_tensors="pt", truncation=True, padding=True, max_length=max_length).to(model.device)
|
||||||
|
|
||||||
|
pred_ids = model.generate(**batch_encodings, max_new_tokens=max_new_tokens)
|
||||||
|
outputs += tokenizer.batch_decode(pred_ids, skip_special_tokens=True)
|
||||||
|
|
||||||
|
return [output.split("<|output|>")[1] for output in outputs]
|
||||||
|
|
||||||
|
model_name = "numind/NuExtract-v1.5"
|
||||||
|
device = "cuda"
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, trust_remote_code=True).to(device).eval()
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
||||||
|
|
||||||
|
text = """We introduce Mistral 7B, a 7–billion-parameter language model engineered for
|
||||||
|
superior performance and efficiency. Mistral 7B outperforms the best open 13B
|
||||||
|
model (Llama 2) across all evaluated benchmarks, and the best released 34B
|
||||||
|
model (Llama 1) in reasoning, mathematics, and code generation. Our model
|
||||||
|
leverages grouped-query attention (GQA) for faster inference, coupled with sliding
|
||||||
|
window attention (SWA) to effectively handle sequences of arbitrary length with a
|
||||||
|
reduced inference cost. We also provide a model fine-tuned to follow instructions,
|
||||||
|
Mistral 7B – Instruct, that surpasses Llama 2 13B – chat model both on human and
|
||||||
|
automated benchmarks. Our models are released under the Apache 2.0 license.
|
||||||
|
Code: <https://github.com/mistralai/mistral-src>
|
||||||
|
Webpage: <https://mistral.ai/news/announcing-mistral-7b/>"""
|
||||||
|
|
||||||
|
template = """{
|
||||||
|
"Model": {
|
||||||
|
"Name": "",
|
||||||
|
"Number of parameters": "",
|
||||||
|
"Number of max token": "",
|
||||||
|
"Architecture": []
|
||||||
|
},
|
||||||
|
"Usage": {
|
||||||
|
"Use case": [],
|
||||||
|
"Licence": ""
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
|
||||||
|
prediction = predict_NuExtract(model, tokenizer, [text], template)[0]
|
||||||
|
print(prediction)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Sliding window prompting:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import json
|
||||||
|
|
||||||
|
MAX_INPUT_SIZE = 20_000
|
||||||
|
MAX_NEW_TOKENS = 6000
|
||||||
|
|
||||||
|
def clean_json_text(text):
|
||||||
|
text = text.strip()
|
||||||
|
text = text.replace("\#", "#").replace("\&", "&")
|
||||||
|
return text
|
||||||
|
|
||||||
|
def predict_chunk(text, template, current, model, tokenizer):
|
||||||
|
current = clean_json_text(current)
|
||||||
|
|
||||||
|
input_llm = f"<|input|>\n### Template:\n{template}\n### Current:\n{current}\n### Text:\n{text}\n\n<|output|>" + "{"
|
||||||
|
input_ids = tokenizer(input_llm, return_tensors="pt", truncation=True, max_length=MAX_INPUT_SIZE).to("cuda")
|
||||||
|
output = tokenizer.decode(model.generate(**input_ids, max_new_tokens=MAX_NEW_TOKENS)[0], skip_special_tokens=True)
|
||||||
|
|
||||||
|
return clean_json_text(output.split("<|output|>")[1])
|
||||||
|
|
||||||
|
def split_document(document, window_size, overlap):
|
||||||
|
tokens = tokenizer.tokenize(document)
|
||||||
|
print(f"\tLength of document: {len(tokens)} tokens")
|
||||||
|
|
||||||
|
chunks = []
|
||||||
|
if len(tokens) > window_size:
|
||||||
|
for i in range(0, len(tokens), window_size-overlap):
|
||||||
|
print(f"\t{i} to {i + len(tokens[i:i + window_size])}")
|
||||||
|
chunk = tokenizer.convert_tokens_to_string(tokens[i:i + window_size])
|
||||||
|
chunks.append(chunk)
|
||||||
|
|
||||||
|
if i + len(tokens[i:i + window_size]) >= len(tokens):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
chunks.append(document)
|
||||||
|
print(f"\tSplit into {len(chunks)} chunks")
|
||||||
|
|
||||||
|
return chunks
|
||||||
|
|
||||||
|
def handle_broken_output(pred, prev):
|
||||||
|
try:
|
||||||
|
if all([(v in ["", []]) for v in json.loads(pred).values()]):
|
||||||
|
# if empty json, return previous
|
||||||
|
pred = prev
|
||||||
|
except:
|
||||||
|
# if broken json, return previous
|
||||||
|
pred = prev
|
||||||
|
|
||||||
|
return pred
|
||||||
|
|
||||||
|
def sliding_window_prediction(text, template, model, tokenizer, window_size=4000, overlap=128):
|
||||||
|
# split text into chunks of n tokens
|
||||||
|
tokens = tokenizer.tokenize(text)
|
||||||
|
chunks = split_document(text, window_size, overlap)
|
||||||
|
|
||||||
|
# iterate over text chunks
|
||||||
|
prev = template
|
||||||
|
for i, chunk in enumerate(chunks):
|
||||||
|
print(f"Processing chunk {i}...")
|
||||||
|
pred = predict_chunk(chunk, template, prev, model, tokenizer)
|
||||||
|
|
||||||
|
# handle broken output
|
||||||
|
pred = handle_broken_output(pred, prev)
|
||||||
|
|
||||||
|
# iterate
|
||||||
|
prev = pred
|
||||||
|
|
||||||
|
return pred
|
||||||
|
```
|
|
@ -0,0 +1,138 @@
|
||||||
|
{
|
||||||
|
"_name_or_path": "numind/NuExtract-v1.5",
|
||||||
|
"architectures": [
|
||||||
|
"Phi3ForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"auto_map": {
|
||||||
|
"AutoConfig": "microsoft/Phi-3.5-mini-instruct--configuration_phi3.Phi3Config",
|
||||||
|
"AutoModelForCausalLM": "microsoft/Phi-3.5-mini-instruct--modeling_phi3.Phi3ForCausalLM"
|
||||||
|
},
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"embd_pdrop": 0.0,
|
||||||
|
"eos_token_id": 32000,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 3072,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 8192,
|
||||||
|
"max_position_embeddings": 131072,
|
||||||
|
"model_type": "phi3",
|
||||||
|
"num_attention_heads": 32,
|
||||||
|
"num_hidden_layers": 32,
|
||||||
|
"num_key_value_heads": 32,
|
||||||
|
"original_max_position_embeddings": 4096,
|
||||||
|
"pad_token_id": 32000,
|
||||||
|
"resid_pdrop": 0.0,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_scaling": {
|
||||||
|
"long_factor": [
|
||||||
|
1.0800000429153442,
|
||||||
|
1.1100000143051147,
|
||||||
|
1.1399999856948853,
|
||||||
|
1.340000033378601,
|
||||||
|
1.5899999141693115,
|
||||||
|
1.600000023841858,
|
||||||
|
1.6200000047683716,
|
||||||
|
2.620000123977661,
|
||||||
|
3.2300000190734863,
|
||||||
|
3.2300000190734863,
|
||||||
|
4.789999961853027,
|
||||||
|
7.400000095367432,
|
||||||
|
7.700000286102295,
|
||||||
|
9.09000015258789,
|
||||||
|
12.199999809265137,
|
||||||
|
17.670000076293945,
|
||||||
|
24.46000099182129,
|
||||||
|
28.57000160217285,
|
||||||
|
30.420001983642578,
|
||||||
|
30.840002059936523,
|
||||||
|
32.590003967285156,
|
||||||
|
32.93000411987305,
|
||||||
|
42.320003509521484,
|
||||||
|
44.96000289916992,
|
||||||
|
50.340003967285156,
|
||||||
|
50.45000457763672,
|
||||||
|
57.55000305175781,
|
||||||
|
57.93000411987305,
|
||||||
|
58.21000289916992,
|
||||||
|
60.1400032043457,
|
||||||
|
62.61000442504883,
|
||||||
|
62.62000274658203,
|
||||||
|
62.71000289916992,
|
||||||
|
63.1400032043457,
|
||||||
|
63.1400032043457,
|
||||||
|
63.77000427246094,
|
||||||
|
63.93000411987305,
|
||||||
|
63.96000289916992,
|
||||||
|
63.970001220703125,
|
||||||
|
64.02999877929688,
|
||||||
|
64.06999969482422,
|
||||||
|
64.08000183105469,
|
||||||
|
64.12000274658203,
|
||||||
|
64.41000366210938,
|
||||||
|
64.4800033569336,
|
||||||
|
64.51000213623047,
|
||||||
|
64.52999877929688,
|
||||||
|
64.83999633789062
|
||||||
|
],
|
||||||
|
"short_factor": [
|
||||||
|
1.0,
|
||||||
|
1.0199999809265137,
|
||||||
|
1.0299999713897705,
|
||||||
|
1.0299999713897705,
|
||||||
|
1.0499999523162842,
|
||||||
|
1.0499999523162842,
|
||||||
|
1.0499999523162842,
|
||||||
|
1.0499999523162842,
|
||||||
|
1.0499999523162842,
|
||||||
|
1.0699999332427979,
|
||||||
|
1.0999999046325684,
|
||||||
|
1.1099998950958252,
|
||||||
|
1.1599998474121094,
|
||||||
|
1.1599998474121094,
|
||||||
|
1.1699998378753662,
|
||||||
|
1.2899998426437378,
|
||||||
|
1.339999794960022,
|
||||||
|
1.679999828338623,
|
||||||
|
1.7899998426437378,
|
||||||
|
1.8199998140335083,
|
||||||
|
1.8499997854232788,
|
||||||
|
1.8799997568130493,
|
||||||
|
1.9099997282028198,
|
||||||
|
1.9399996995925903,
|
||||||
|
1.9899996519088745,
|
||||||
|
2.0199997425079346,
|
||||||
|
2.0199997425079346,
|
||||||
|
2.0199997425079346,
|
||||||
|
2.0199997425079346,
|
||||||
|
2.0199997425079346,
|
||||||
|
2.0199997425079346,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0299997329711914,
|
||||||
|
2.0799996852874756,
|
||||||
|
2.0899996757507324,
|
||||||
|
2.189999580383301,
|
||||||
|
2.2199995517730713,
|
||||||
|
2.5899994373321533,
|
||||||
|
2.729999542236328,
|
||||||
|
2.749999523162842,
|
||||||
|
2.8399994373321533
|
||||||
|
],
|
||||||
|
"type": "longrope"
|
||||||
|
},
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"sliding_window": 262144,
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"transformers_version": "4.44.0",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 32064
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
Binary file not shown.
After Width: | Height: | Size: 148 KiB |
Binary file not shown.
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 32000,
|
||||||
|
"pad_token_id": 32000,
|
||||||
|
"transformers_version": "4.44.0"
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
from typing import Dict, List, Any
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
import torch
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
MAX_INPUT_SIZE = 10_000
|
||||||
|
MAX_NEW_TOKENS = 4_000
|
||||||
|
|
||||||
|
def clean_json_text(text):
|
||||||
|
"""
|
||||||
|
Cleans JSON text by removing leading/trailing whitespace and escaping special characters.
|
||||||
|
"""
|
||||||
|
text = text.strip()
|
||||||
|
text = text.replace("\#", "#").replace("\&", "&")
|
||||||
|
return text
|
||||||
|
|
||||||
|
class EndpointHandler:
|
||||||
|
def __init__(self, path=""):
|
||||||
|
# load model and processor from path
|
||||||
|
self.model = AutoModelForCausalLM.from_pretrained(path,
|
||||||
|
trust_remote_code=True,
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
device_map="auto")
|
||||||
|
self.model.eval()
|
||||||
|
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
||||||
|
|
||||||
|
def __call__(self, data: Dict[str, Any]) -> str:
|
||||||
|
data = data.pop("inputs")
|
||||||
|
template = data.pop("template")
|
||||||
|
text = data.pop("text")
|
||||||
|
input_llm = f"<|input|>\n### Template:\n{template}\n### Text:\n{text}\n\n<|output|>" + "{"
|
||||||
|
|
||||||
|
input_ids = self.tokenizer(input_llm, return_tensors="pt", truncation=True, max_length=MAX_INPUT_SIZE).to("cuda")
|
||||||
|
output = self.tokenizer.decode(self.model.generate(**input_ids, max_new_tokens=MAX_NEW_TOKENS)[0], skip_special_tokens=True)
|
||||||
|
|
||||||
|
return clean_json_text(output.split("<|output|>")[1])
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,202 @@
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"total_size": 7642159104
|
||||||
|
},
|
||||||
|
"weight_map": {
|
||||||
|
"lm_head.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.embed_tokens.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.0.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.1.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.10.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.11.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.12.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.13.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.14.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.15.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.16.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.17.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.18.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.19.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.2.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.20.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.21.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.21.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.22.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.23.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.24.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.25.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.26.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.27.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.28.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.28.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.28.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.28.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.28.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.28.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.29.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.29.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.29.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.29.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.29.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.29.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.3.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.3.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.30.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.30.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.30.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.30.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.30.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.30.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.31.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.31.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.31.mlp.gate_up_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.31.post_attention_layernorm.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.31.self_attn.o_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.31.self_attn.qkv_proj.weight": "model-00002-of-00002.safetensors",
|
||||||
|
"model.layers.4.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.4.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.5.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.6.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.7.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.8.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.mlp.gate_up_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.layers.9.self_attn.qkv_proj.weight": "model-00001-of-00002.safetensors",
|
||||||
|
"model.norm.weight": "model-00002-of-00002.safetensors"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,137 @@
|
||||||
|
{
|
||||||
|
"add_bos_token": false,
|
||||||
|
"add_eos_token": false,
|
||||||
|
"add_prefix_space": null,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"0": {
|
||||||
|
"content": "<unk>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"content": "<s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"content": "</s>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": false
|
||||||
|
},
|
||||||
|
"32000": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32001": {
|
||||||
|
"content": "<|assistant|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32002": {
|
||||||
|
"content": "<|placeholder1|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32003": {
|
||||||
|
"content": "<|placeholder2|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32004": {
|
||||||
|
"content": "<|placeholder3|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32005": {
|
||||||
|
"content": "<|placeholder4|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32006": {
|
||||||
|
"content": "<|system|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32007": {
|
||||||
|
"content": "<|end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32008": {
|
||||||
|
"content": "<|placeholder5|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32009": {
|
||||||
|
"content": "<|placeholder6|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"32010": {
|
||||||
|
"content": "<|user|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": true,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bos_token": "<s>",
|
||||||
|
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' and message['content'] %}{{'<|system|>\n' + message['content'] + '<|end|>\n'}}{% elif message['role'] == 'user' %}{{'<|user|>\n' + message['content'] + '<|end|>\n'}}{% elif message['role'] == 'assistant' %}{{'<|assistant|>\n' + message['content'] + '<|end|>\n'}}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>\n' }}{% else %}{{ eos_token }}{% endif %}",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|endoftext|>",
|
||||||
|
"legacy": false,
|
||||||
|
"max_length": 4000,
|
||||||
|
"model_max_length": 131072,
|
||||||
|
"pad_to_multiple_of": null,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"pad_token_type_id": 0,
|
||||||
|
"padding_side": "left",
|
||||||
|
"sp_model_kwargs": {},
|
||||||
|
"stride": 0,
|
||||||
|
"tokenizer_class": "LlamaTokenizer",
|
||||||
|
"truncation_side": "right",
|
||||||
|
"truncation_strategy": "longest_first",
|
||||||
|
"unk_token": "<unk>",
|
||||||
|
"use_default_system_prompt": false
|
||||||
|
}
|
Loading…
Reference in New Issue