ActionBERT 109M (fine tuned from bert-base-uncased)

This is a 109M parameter model fine-tuned to detect actions vs. non-action descriptions of stock images. It outputs a tensor with two values, one for the probability of it being an action and zero for the probability of it being a non-action.

Example Inference Code

from transformers import AutoModelForSequenceClassification, AutoTokenizer
from tabulate import tabulate
import torch
import torch.nn.functional as F

# Load the model and tokenizer from the Hugging Face Hub
model_name = "qingy2024/ActionBERT-109M"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

text = "A mushroom exploding in a forest."

inputs = tokenizer(text, truncation=True, max_length=512, padding=True, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)
    action_probability, no_action_probability = F.softmax(outputs.logits[0], dim = 0).tolist()

    table = [
        ['Probability of Action', action_probability],
        ['Probability of No Action', no_action_probability]
    ]
    
    print(tabulate(table, tablefmt='rounded_grid'))

Output

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Probability of Action    โ”‚ 0.999654    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Probability of No Action โ”‚ 0.000346127 โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
Downloads last month
10
Safetensors
Model size
109M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for qingy2024/ActionBert-109M

Finetuned
(5392)
this model

Dataset used to train qingy2024/ActionBert-109M