Downloads · 30 days
9
38% of all-time downloads
yqq1231231/rl-chat-tinyllama
rl-chat-tinyllama is a machine learning model from yqq1231231. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a RL-optimized chat model based on TinyLlama/TinyLlama-1.1B-Chat-v1.0.
Downloads · 30 days
9
38% of all-time downloads
All-time downloads
24
Public
Repo size
1.1 MB
Likes
0
Public
Click a slice to open those files.
.pt1.1 MB · 99%
From the Hugging Face model README
This repository contains a RL-optimized chat model based on TinyLlama/TinyLlama-1.1B-Chat-v1.0.
This model uses a DQN (Deep Q-Network) agent to select the best prompting strategy for a base language model.
git clone https://huggingface.co/yqq1231231/rl-chat-tinyllama
cd rl-chat-tinyllama
pip install torch transformers numpy
python chat.py
You can also use the model directly in your code:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from src.models.rl_agent import DQNAgent
# 1. Load the RL model
agent_config = {
'state_dim': 1,
'action_dim': 3,
}
agent = DQNAgent(agent_config)
agent.load("best_model.pt")
# 2. Load the base language model
base_model = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
tokenizer = AutoTokenizer.from_pretrained(base_model)
model = AutoModelForCausalLM.from_pretrained(base_model)
# Now you can use both models together!
This model was trained using reinforcement learning to optimize prompt selection for better responses, using the DQN algorithm with reward signals to guide the model toward better prompting strategies.