Views
No views yet
1from huggingface_hub import hf_hub_download
2import torch
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5# 1. Download the RL model
6rl_model_path = hf_hub_download(repo_id="yqq1231231/emotional_agent", filename="best_model.pt")
7
8# 2. Load the base language model
9base_model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
10base_model = AutoModelForCausalLM.from_pretrained(base_model_name)
11tokenizer = AutoTokenizer.from_pretrained(base_model_name)
12
13# 3. Load the RL model
14rl_agent = torch.load(rl_model_path)
15
16# Now you can use both models together!