Views
No views yet
LSTM-Generative baseline model from the research paper "An Automated Pipeline for Constructing a Vietnamese VQA-NLE Dataset". The model is designed for Visual Question Answering with Natural Language Explanations (VQA-NLE) in Vietnamese.1import torch
2from huggingface_hub import hf_hub_download
3# You need to have the model definition file, for example: from src.models.baseline_model.vivqax_model import ViVQAX_Model
4
5# Download checkpoint from Hub
6checkpoint_path = hf_hub_download(
7 repo_id="VLAI-AIVN/ViVQA-X_LSTM-Generative", # <-- REPLACE WITH YOUR MODEL REPO NAME
8 filename="best_model.pth" # Checkpoint file name
9)
10
11# Load checkpoint
12checkpoint = torch.load(checkpoint_path, map_location='cpu')
13
14# Initialize model with structure and vocab from checkpoint
15# (This is an example, you need to adjust it to your code)
16# model = ViVQAX_Model(
17# vocab_size=len(checkpoint['word2idx']),
18# embed_size=checkpoint['config']['model']['embed_size'],
19# # ... other parameters
20# )
21
22# Load trained weights
23# model.load_state_dict(checkpoint['model_state_dict'])
24# model.eval()
25
26print("Model loaded successfully!")
27# Now you can use the model to predict