Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,65 @@
|
|
1 |
---
|
2 |
-
license:
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
datasets:
|
6 |
+
- Universal-NER/Pile-NER-type
|
7 |
---
|
8 |
+
|
9 |
+
---
|
10 |
+
|
11 |
+
|
12 |
+
# UniNER-7B-all
|
13 |
+
|
14 |
+
**Description**: This model is self fine-tuned from [TinyLLama](https://huggingface.co/TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T). It is trained on ChatGPT-generated [Pile-NER-type data](https://huggingface.co/datasets/Universal-NER/Pile-NER-type).
|
15 |
+
|
16 |
+
Check our [paper](https://arxiv.org/abs/2308.03279) for more information.
|
17 |
+
|
18 |
+
## Inference
|
19 |
+
# Install transformers from source - only needed for versions <= v4.34
|
20 |
+
# pip install git+https://github.com/huggingface/transformers.git
|
21 |
+
# pip install accelerate
|
22 |
+
|
23 |
+
import torch
|
24 |
+
from transformers import pipeline
|
25 |
+
|
26 |
+
pipe = pipeline("text-generation", model="/media/4TB_1/minhtt/Documents/test/axolotl/lora-out/merged",
|
27 |
+
torch_dtype=torch.bfloat16, device_map="auto")
|
28 |
+
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templating
|
29 |
+
messages = [
|
30 |
+
{
|
31 |
+
"role": "system",
|
32 |
+
"content": "A virtual assistant answers questions from a user based on the provided text.",
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"role": "user",
|
36 |
+
"content": "Text: The American Bank Note Company Printing Plant is a repurposed complex of three interconnected buildings in the Hunts Point neighborhood of the Bronx in New York City. The innovative Kirby, Petit & Green design was built in 1909–1911 by the American Bank Note Company on land which had previously been part of Edward G. Faile's country estate. A wide variety of financial instruments were printed there; at one point, over five million documents were produced per day, including half the securities traded on the New York Stock Exchange."
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"role": "assistant",
|
40 |
+
"content": "I've read this text."
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"role": "user",
|
44 |
+
"content": "What describes location in the text?"
|
45 |
+
}
|
46 |
+
]
|
47 |
+
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
48 |
+
outputs = pipe(prompt, max_new_tokens=256, do_sample=False)
|
49 |
+
print(outputs[0]["generated_text"])
|
50 |
+
#<|system|>
|
51 |
+
#A virtual assistant answers questions from a user based on the provided text.</s>
|
52 |
+
#<|user|>
|
53 |
+
#Text: The American Bank Note Company Printing Plant is a repurposed complex of three interconnected buildings in the Hunts Point neighborhood of the Bronx in New York City. The innovative Kirby, Petit & Green design was built in 1909–1911 by the American Bank Note Company on land which had previously been part of Edward G. Faile's country estate. A wide variety of financial instruments were printed there; at one point, over five million documents were produced per day, including half the securities traded on the New York Stock Exchange.</s>
|
54 |
+
#<|assistant|>
|
55 |
+
#I've read this text.</s>
|
56 |
+
#<|user|>
|
57 |
+
#What describes location in the text?</s>
|
58 |
+
#<|assistant|>
|
59 |
+
#["Hunts Point", "Bronx", "New York City"]
|
60 |
+
|
61 |
+
### Note: Inferences are based on one entity type at a time. For multiple entity types, create separate instances for each type.
|
62 |
+
|
63 |
+
## License
|
64 |
+
|
65 |
+
This model and its associated data are released under the [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) license. They are primarily used for research purposes.
|