Views
No views yet
TinyRecursiveModel)roberta-base hoặc ProsusAI/finbert]TinyRecursiveModel architecture, you will need the original class definition in your codebase to load the weights properly.1import torch
2from transformers import AutoTokenizer
3from huggingface_hub import hf_hub_download
4# Nhớ import class TinyRecursiveModel từ source code của mày
5# from your_custom_module import TinyRecursiveModel
6
7repo_id = "KenyaWashed/trm-convfinqa"
8
9# 1. Load Tokenizer
10tokenizer = AutoTokenizer.from_pretrained(repo_id)
11
12# 2. Khởi tạo model base (nhớ truyền đúng tham số lúc train)
13model = TinyRecursiveModel(
14 # [Điền các tham số khởi tạo model của mày vào đây]
15)
16
17# 3. Download weights từ Hugging Face và load vào model
18model_path = hf_hub_download(repo_id=repo_id, filename="pytorch_model.bin")
19model.load_state_dict(torch.load(model_path, map_location="cpu"))
20model.eval()
21
22print("Model loaded successfully!")