Edit model card

Model Card for Model ID

base_model : FacebookAI/xlm-roberta-large

hidden_size : 1024

max_position_embeddings : 512

num_attention_heads : 16

num_hidden_layers : 24

vocab_size : 250002

Basic usage

from transformers import AutoTokenizer, AutoModelForTokenClassification
import numpy as np

# match tag
id2tag = {0:'O', 1:'B_MT', 2:'I_MT'}

# load model & tokenizer
MODEL_NAME = 'MDDDDR/roberta_large_NER'

model = AutoModelForTokenClassification.from_pretrained(MODEL_NAME)
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)

# prepare input
text = 'mental disorder can also contribute to the development of diabetes through various mechanism including increased stress, poor self care behavior, and adverse effect on glucose metabolism.'
tokenized = tokenizer(text, return_tensors='pt')

# forward pass
output = model(**tokenized)

# result
pred = np.argmax(output[0].cpu().detach().numpy(), axis=2)[0][1:-1]

# check pred
for txt, pred in zip(tokenizer.tokenize(text), pred):
    print("{}\t{}".format(id2tag[pred], txt))
    # B_MT	▁mental 
    # B_MT	▁disorder

Framework versions

  • transformers : 4.39.1
  • torch : 2.1.0+cu121
  • datasets : 2.18.0
  • tokenizers : 0.15.2
  • numpy : 1.20.0
Downloads last month
7
Safetensors
Model size
559M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train MDDDDR/roberta_large_NER