đ aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0
This model is a fine - tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0, which is optimized for generating synthetic survey responses across multiple domains. It can generate responses reflecting specific personas, offering high - quality synthetic data for various survey needs.
đ Quick Start
This model is specifically designed for generating synthetic survey responses from different personas. To get the best results, you need to provide a detailed persona description and a specific survey question.
⨠Features
- Domain - Adaptable: Optimized for generating synthetic survey responses across multiple domains.
- Persona - Aware: Instruction - tuned to generate responses reflecting specific personas.
đĻ Installation
No specific installation steps are provided in the original document.
đģ Usage Examples
Basic Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0", device_map="auto", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0", trust_remote_code=True)
persona = "A nurse who educates the child about modern medical treatments and encourages a balanced approach to healthcare"
question = "How often was your pain well controlled during this hospital stay?"
system_prompt = f"You are embodying the following persona: {persona}"
user_prompt = f"Survey Question: {question}\n\nPlease provide your honest and detailed response to this question."
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt}
]
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(model.device)
import torch
with torch.no_grad():
output_ids = model.generate(
input_ids=input_ids,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
do_sample=True
)
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
response_start = output.find(input_text) + len(input_text)
generated_response = output[response_start:].strip()
print(f"Generated response: {generated_response}")
Advanced Usage
import requests
API_URL = "https://api-inference.huggingface.co/models/aryashah00/survey-finetuned-TinyLlama-1.1B-Chat-v1.0"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
messages = [
{"role": "system", "content": "You are embodying the following persona: A nurse who educates the child about modern medical treatments and encourages a balanced approach to healthcare"},
{"role": "user", "content": "Survey Question: How often was your pain well controlled during this hospital stay?\n\nPlease provide your honest and detailed response to this question."}
]
output = query({"inputs": messages})
print(output)
đ Documentation
Model Description
This model is a fine - tuned version of TinyLlama/TinyLlama-1.1B-Chat-v1.0 optimized for generating synthetic survey responses across multiple domains. It has been instruction - tuned using a custom dataset of survey responses, with each response reflecting a specific persona.
Training Data
Property |
Details |
Dataset Size |
~3,000 examples |
Domains |
10 domains including healthcare, education, etc. |
Format |
ChatML instruction format with system and user prompts |
Training Details
- Base Model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
- Training Method: Parameter - Efficient Fine - Tuning with LoRA
- LoRA Parameters: r = 16, alpha = 32, dropout = 0.05
- Training Setup:
- Batch Size: 8
- Learning Rate: 0.0002
- Epochs: 5
đ§ Technical Details
- Base Model: The model is based on TinyLlama/TinyLlama-1.1B-Chat-v1.0.
- Fine - Tuning: It uses Parameter - Efficient Fine - Tuning with LoRA, with specific parameters (r = 16, alpha = 32, dropout = 0.05) to adapt the base model to generate synthetic survey responses.
đ License
This model follows the license of the base model TinyLlama/TinyLlama-1.1B-Chat-v1.0.
â ī¸ Important Note
- The model is optimized for survey response generation and may not perform well on other tasks.
- Response quality depends on the clarity and specificity of the persona and question.
- The model may occasionally generate responses that don't fully align with the given persona.