Downloads · 30 days
0
Rudra12567/albef-price-prediction
albef-price-prediction is a machine learning model from Rudra12567. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This is a multimodal ALBEF (Align Before Fuse) model trained for product price prediction using both images and text descriptions.
Downloads · 30 days
0
Access
Public
Updated Oct 13, 2025
Repo size
20.1 GB
Likes
0
Public
Click a slice to open those files.
.pth12.2 GB · 100%
From the Hugging Face model README
This is a multimodal ALBEF (Align Before Fuse) model trained for product price prediction using both images and text descriptions.
| Metric | Value |
|---|---|
| Validation Loss | 0.8670 |
| RMSE | 29.24 |
| MAE | 13.00 |
| SMAPE | 56.06% |
| MAPE | 73.07% |
import torch
from transformers import AutoTokenizer
from PIL import Image
import torchvision.transforms as T
from huggingface_hub import hf_hub_download
# Download checkpoint
checkpoint_path = hf_hub_download(
repo_id="Rudra12567/albef-price-prediction",
filename="best_model.pth"
)
# Load checkpoint
checkpoint = torch.load(checkpoint_path)
# Initialize your model and load state_dict
# model.load_state_dict(checkpoint['model_state_dict'])
# Prepare image
transform = T.Compose([
T.Resize((224, 224)),
T.ToTensor(),
T.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
])
image = Image.open('product.jpg').convert('RGB')
pixel_values = transform(image).unsqueeze(0)
# Prepare text
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
text_inputs = tokenizer(
"Product description here",
truncation=True,
padding='max_length',
max_length=128,
return_tensors='pt'
)
# Predict
with torch.no_grad():
outputs = model(pixel_values, text_inputs)
price_log = outputs['price_pred']
price = torch.expm1(price_log)
Apache 2.0