Run this model with HF Jobs
Run ProdicusII/ZeroShotBioNER on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ProdicusII/ZeroShotBioNER. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ProdicusII/ZeroShotBioNER on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ProdicusII/ZeroShotBioNER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ProdicusII/ZeroShotBioNER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ProdicusII/ZeroShotBioNER")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ProdicusII/ZeroShotBioNER") model = AutoModelForTokenClassification.from_pretrained("ProdicusII/ZeroShotBioNER", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
2eb159d
1
Parent(s): 7edec27
Update code (#4)
Browse files- Update code (c7b407e5bf5482f6c7d5947f80167d98c7190b1b)
Co-authored-by: Nikola <nikolamilosevic@users.noreply.huggingface.co>
18 unmodified lines192021222324252 unmodified lines28293030313232333435363435363738373839404142434044454647484918 unmodified lines- medical- zero-shot- few-shotlibrary_name: transformers---# Zero and few shot NER for biomedical texts
2 unmodified linesmodel outputs list of zeros and ones corresponding to the occurance of Named Entity and corresponing to the tokens(tokens given by transformer tokenizer) of the Sring2.
## Example of usage
```from transformers import AutoTokenizermodelname='./' #modelpathfrom transformers import BertForTokenClassification
modelname = 'ProdicusII/ZeroShotBioNER' # modelpathtokenizer = AutoTokenizer.from_pretrained(modelname) ## loading the tokenizer of that modelstring1='Drug'string2='No recent antibiotics or other nephrotoxins, and no symptoms of UTI with benign UA.'encodings = tokenizer(string1,string2, is_split_into_words=False, padding=True, truncation=True, add_special_tokens=True, return_offsets_mapping=False,max_length=512,return_tensors='pt')from transformers import BertForTokenClassification #AutoModelForPreTrainingstring1 = 'Drug'string2 = 'No recent antibiotics or other nephrotoxins, and no symptoms of UTI with benign UA.'encodings = tokenizer(string1, string2, is_split_into_words=False, padding=True, truncation=True, add_special_tokens=True, return_offsets_mapping=False, max_length=512, return_tensors='pt')
model = BertForTokenClassification.from_pretrained(modelname, num_labels=2)prediction_logits=model(**encodings)prediction_logits = model(**encodings)print(prediction_logits)```
## Code availibility
README.md+14-8