NuExtract_tiny is a version of
Qwen1.5-0.5
, fine-tuned on a private high-quality synthetic dataset for information extraction. To use the model, provide an input text (less than 2000 tokens) and a JSON template describing the information you need to extract.
Note: This model is purely extractive, so all text output by the model is present as is in the original text. You can also provide an example of output formatting to help the model understand your task more precisely.
Note: While this model provides good 0 shot performance, it is intended to be fine-tuned on a specific task (>=30 examples).
import json
from transformers import AutoModelForCausalLM, AutoTokenizer
defpredict_NuExtract(model, tokenizer, text, schema, example=["","",""]):
schema = json.dumps(json.loads(schema), indent=4)
input_llm = "<|input|>\n### Template:\n" + schema + "\n"for i in example:
if i != "":
input_llm += "### Example:\n"+ json.dumps(json.loads(i), indent=4)+"\n"
input_llm += "### Text:\n"+text +"\n<|output|>\n"
input_ids = tokenizer(input_llm, return_tensors="pt", truncation=True, max_length=4000).to("cuda")
output = tokenizer.decode(model.generate(**input_ids)[0], skip_special_tokens=True)
return output.split("<|output|>")[1].split("<|end-output|>")[0]
model = AutoModelForCausalLM.from_pretrained("numind/NuExtract-tiny", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("numind/NuExtract-tiny", trust_remote_code=True)
model.to("cuda")
model.eval()
text = """We introduce Mistral 7B, a 7–billion-parameter language model engineered forsuperior performance and efficiency. Mistral 7B outperforms the best open 13Bmodel (Llama 2) across all evaluated benchmarks, and the best released 34Bmodel (Llama 1) in reasoning, mathematics, and code generation. Our modelleverages grouped-query attention (GQA) for faster inference, coupled with slidingwindow attention (SWA) to effectively handle sequences of arbitrary length with areduced 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 andautomated benchmarks. Our models are released under the Apache 2.0 license.Code: https://github.com/mistralai/mistral-srcWebpage: https://mistral.ai/news/announcing-mistral-7b/"""
schema = """{ "Model": { "Name": "", "Number of parameters": "", "Number of max token": "", "Architecture": [] }, "Usage": { "Use case": [], "Licence": "" }}"""
prediction = predict_NuExtract(model, tokenizer, text, schema, example=["","",""])
print(prediction)
Runs of numind NuExtract-tiny on huggingface.co
17.2K
Total runs
0
24-hour runs
0
3-day runs
296
7-day runs
-465
30-day runs
More Information About NuExtract-tiny huggingface.co Model
NuExtract-tiny huggingface.co is an AI model on huggingface.co that provides NuExtract-tiny's model effect (), which can be used instantly with this numind NuExtract-tiny model. huggingface.co supports a free trial of the NuExtract-tiny model, and also provides paid use of the NuExtract-tiny. Support call NuExtract-tiny model through api, including Node.js, Python, http.
NuExtract-tiny huggingface.co is an online trial and call api platform, which integrates NuExtract-tiny's modeling effects, including api services, and provides a free online trial of NuExtract-tiny, you can try NuExtract-tiny online for free by clicking the link below.
numind NuExtract-tiny online free url in huggingface.co:
NuExtract-tiny is an open source model from GitHub that offers a free installation service, and any user can find NuExtract-tiny on GitHub to install. At the same time, huggingface.co provides the effect of NuExtract-tiny install, users can directly use NuExtract-tiny installed effect in huggingface.co for debugging and trial. It also supports api for free installation.