USAGE
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
MODEL_NAME = "swarogthehater/IMAGE_INTENT"
model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME, load_in_8bit=True)
model.eval()
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
text = "show me yourself"
IMAGE_INTENT = "[IMG]"
input_text = text+"[SEP]"+IMAGE_INTENT+"[SEP]"
device = torch.device("cpu")
batch = tokenizer.encode_plus(input_text, return_tensors="pt")
input_ids = batch['input_ids'].to(device)
attention_mask = batch['attention_mask'].to(device)
token_type_ids = batch['token_type_ids'].to(device)
outputs = model(input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)
print(outputs.logits.argmax().item())
label = 1 if outputs.logits.argmax().item() == 0 else 0
print(label)
print(outputs.logits.float().softmax(dim=-1).detach().numpy())