Instructions to use lil-lab/respect with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lil-lab/respect with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="lil-lab/respect")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("lil-lab/respect", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use lil-lab/respect with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lil-lab/respect" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lil-lab/respect", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lil-lab/respect
- SGLang
How to use lil-lab/respect with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "lil-lab/respect" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lil-lab/respect", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "lil-lab/respect" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lil-lab/respect", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lil-lab/respect with Docker Model Runner:
docker model run hf.co/lil-lab/respect
metadata
base_model:
- HuggingFaceM4/idefics2-8b
language:
- en
license: apache-2.0
pipeline_tag: image-text-to-text
library_name: transformers
The Era of Real-World Human Interaction: RL from User Conversations
This repository contains the lil-lab/respect model, based on the ACL paper Retrospective Learning from Interactions. For more resources, please see https://lil-lab.github.io/respect and https://github.com/lil-lab/respect.
Sample Usage
To get started with the model, follow these steps:
1. Setting up Environment
Prepare your conda environment:
conda create -n respect python=3.9.18
pip install -r requirements.txt
pip install -e .
2. Download Data
from datasets import load_dataset
ds = load_dataset("lil-lab/respect", name="turn", split="train")
3. Load Model Checkpoints
Download checkpoints and load the model using transformers and peft:
import torch
from transformers import Idefics2ForConditionalGeneration
from peft import PeftModel
checkpoint = "HuggingFaceM4/idefics2-8b"
model_id = 'lil-lab/respect'
model = Idefics2ForConditionalGeneration.from_pretrained(
checkpoint, torch_dtype=torch.bfloat16)
peft_model = PeftModel.from_pretrained(
model, model_id, adapter_name="r6_bp", revision="r6_bp")
Reproducibility
To generate plots from the paper, run analysis/plots.ipynb in the GitHub repository.