Downloads · 30 days
0
yodacorp/trailer-gen
trailer-gen is a machine learning model from yodacorp. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
import torch from transformers import AutoTokenizer, AutoModelForSequenceClassification
Downloads · 30 days
0
Access
Public
Updated Oct 30, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 70%
From the Hugging Face model README
import torch from transformers import AutoTokenizer, AutoModelForSequenceClassification
class MovieTrailerModel: def init(self, model_name='bert-base-uncased'): self.tokenizer = AutoTokenizer.from_pretrained(model_name) self.model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels=5)
def predict(self, prompt):
inputs = self.tokenizer(prompt, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
outputs = self.model(**inputs)
probabilities = torch.sigmoid(outputs.logits) # Convert logits to probabilities
return probabilities