Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| NuExtract-tiny.Q2_K.gguf | Q2_K | 0.23GB |
| NuExtract-tiny.IQ3_XS.gguf | IQ3_XS | 0.24GB |
| NuExtract-tiny.IQ3_S.gguf | IQ3_S | 0.25GB |
| NuExtract-tiny.Q3_K_S.gguf | Q3_K_S | 0.25GB |
| NuExtract-tiny.IQ3_M.gguf | IQ3_M | 0.26GB |
| NuExtract-tiny.Q3_K.gguf | Q3_K | 0.26GB |
| NuExtract-tiny.Q3_K_M.gguf | Q3_K_M | 0.26GB |
| NuExtract-tiny.Q3_K_L.gguf | Q3_K_L | 0.28GB |
| NuExtract-tiny.IQ4_XS.gguf | IQ4_XS | 0.28GB |
| NuExtract-tiny.Q4_0.gguf | Q4_0 | 0.29GB |
| NuExtract-tiny.IQ4_NL.gguf | IQ4_NL | 0.29GB |
| NuExtract-tiny.Q4_K_S.gguf | Q4_K_S | 0.29GB |
| NuExtract-tiny.Q4_K.gguf | Q4_K | 0.3GB |
| NuExtract-tiny.Q4_K_M.gguf | Q4_K_M | 0.3GB |
| NuExtract-tiny.Q4_1.gguf | Q4_1 | 0.3GB |
| NuExtract-tiny.Q5_0.gguf | Q5_0 | 0.32GB |
| NuExtract-tiny.Q5_K_S.gguf | Q5_K_S | 0.32GB |
| NuExtract-tiny.Q5_K.gguf | Q5_K | 0.33GB |
| NuExtract-tiny.Q5_K_M.gguf | Q5_K_M | 0.33GB |
| NuExtract-tiny.Q5_1.gguf | Q5_1 | 0.34GB |
| NuExtract-tiny.Q6_K.gguf | Q6_K | 0.36GB |
| NuExtract-tiny.Q8_0.gguf | Q8_0 | 0.47GB |
1import json
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4
5def predict_NuExtract(model, tokenizer, text, schema, example=["","",""]):
6 schema = json.dumps(json.loads(schema), indent=4)
7 input_llm = "<|input|>\n### Template:\n" + schema + "\n"
8 for i in example:
9 if i != "":
10 input_llm += "### Example:\n"+ json.dumps(json.loads(i), indent=4)+"\n"
11
12 input_llm += "### Text:\n"+text +"\n<|output|>\n"
13 input_ids = tokenizer(input_llm, return_tensors="pt", truncation=True, max_length=4000).to("cuda")
14
15 output = tokenizer.decode(model.generate(**input_ids)[0], skip_special_tokens=True)
16 return output.split("<|output|>")[1].split("<|end-output|>")[0]
17
18
19model = AutoModelForCausalLM.from_pretrained("numind/NuExtract-tiny", trust_remote_code=True)
20tokenizer = AutoTokenizer.from_pretrained("numind/NuExtract-tiny", trust_remote_code=True)
21
22model.to("cuda")
23
24model.eval()
25
26text = """We introduce Mistral 7B, a 7–billion-parameter language model engineered for
27superior performance and efficiency. Mistral 7B outperforms the best open 13B
28model (Llama 2) across all evaluated benchmarks, and the best released 34B
29model (Llama 1) in reasoning, mathematics, and code generation. Our model
30leverages grouped-query attention (GQA) for faster inference, coupled with sliding
31window attention (SWA) to effectively handle sequences of arbitrary length with a
32reduced inference cost. We also provide a model fine-tuned to follow instructions,
33Mistral 7B – Instruct, that surpasses Llama 2 13B – chat model both on human and
34automated benchmarks. Our models are released under the Apache 2.0 license.
35Code: https://github.com/mistralai/mistral-src
36Webpage: https://mistral.ai/news/announcing-mistral-7b/"""
37
38schema = """{
39 "Model": {
40 "Name": "",
41 "Number of parameters": "",
42 "Number of max token": "",
43 "Architecture": []
44 },
45 "Usage": {
46 "Use case": [],
47 "Licence": ""
48 }
49}"""
50
51prediction = predict_NuExtract(model, tokenizer, text, schema, example=["","",""])
52print(prediction)
53