ncbi/pubmed
Updated • 877 • 163
How to use ml4pubmed/scibert-scivocab-uncased_pub_section with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="ml4pubmed/scibert-scivocab-uncased_pub_section") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("ml4pubmed/scibert-scivocab-uncased_pub_section")
model = AutoModelForSequenceClassification.from_pretrained("ml4pubmed/scibert-scivocab-uncased_pub_section")allenai/scibert_scivocab_uncased for document section text classificationinstall transformers as needed: pip install -U transformers
run the following, changing the example text to your use case:
from transformers import pipeline
model_tag = "ml4pubmed/scibert-scivocab-uncased_pub_section"
classifier = pipeline(
'text-classification',
model=model_tag,
)
prompt = """
Experiments on two machine translation tasks show these models to be superior in quality while being more parallelizable and requiring significantly less time to train.
"""
classifier(
prompt,
) # classify the sentence
date_run: Apr-25-2022_t-03
huggingface_tag: allenai/scibert_scivocab_uncased
date_run: Apr-25-2022_t-03
huggingface_tag: allenai/scibert_scivocab_uncased