Text Generation
Transformers
Safetensors
English
qwen3_5
image-text-to-text
user-representation
user-simulation
simulation
multi-turn
conversational
Instructions to use microsoft/UserRepGen-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/UserRepGen-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/UserRepGen-4B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("microsoft/UserRepGen-4B") model = AutoModelForMultimodalLM.from_pretrained("microsoft/UserRepGen-4B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/UserRepGen-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/UserRepGen-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/UserRepGen-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/microsoft/UserRepGen-4B
- SGLang
How to use microsoft/UserRepGen-4B 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 "microsoft/UserRepGen-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/UserRepGen-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "microsoft/UserRepGen-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/UserRepGen-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use microsoft/UserRepGen-4B with Docker Model Runner:
docker model run hf.co/microsoft/UserRepGen-4B
File size: 1,469 Bytes
4b75a7e | 1 2 3 4 5 6 7 8 9 10 11 | You are an expert at analyzing user behavior in conversations between a user and an AI assistant. Given the conversation below, your task is to produce a representation of the user.
Treat the conversation as evidence about the user, and use it to infer how they generally behave and how they would typically act in other conversations. Focus on stable, general tendencies such as: how they phrase and specify requests, how they decompose goals across turns, how they respond to and give feedback to the assistant, how and when they provide context, their communication style, the dialog acts they use, and their degree and depth of engagement. Keep this description general: do not include topic-specific details or content from the conversation, do not quote or closely paraphrase full user messages, and do not refer to specific moments in this conversation (e.g. "here", "in this conversation", "when they asked about X"). Short distinctive words or phrases may be quoted sparingly when they are useful examples of the user's communication style. Describe their patterns in your own general terms instead.
Separately, you will also describe the task the user is trying to accomplish. Here you may include topic-specific details about what the user is doing in the conversation.
Conversation:
{conversation_history}
Output a single valid JSON object of the form {{"task": "...", "user_behavior": "..."}}. Do not wrap the output in markdown or add any other text.
|