Downloads · 30 days
7
10% of all-time downloads
aryashah00/survey-finetuned-Mistral-7B-Instruct-v0.3
survey-finetuned-Mistral-7B-Instruct-v0.3 is a text generation model from aryashah00. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
This model is a fine-tuned version of mistralai/Mistral-7B-Instruct-v0.3 optimized for generating synthetic survey responses across multiple domains. It has been instruction-tuned using a custom dataset of survey resp…
Downloads · 30 days
7
10% of all-time downloads
All-time downloads
67
Public
Parameters
7.2B
9.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.7 GB · 89%
How the weights are stored.
I87B · 96%
From the Hugging Face model README
This model is a fine-tuned version of mistralai/Mistral-7B-Instruct-v0.3 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.
This model is specifically designed for generating synthetic survey responses from different personas. It works best when provided with:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained("aryashah00/survey-finetuned-Mistral-7B-Instruct-v0.3", device_map="auto", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("aryashah00/survey-finetuned-Mistral-7B-Instruct-v0.3", trust_remote_code=True)
# Define persona and question
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?"
# Prepare prompts
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."
# Create message format
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt}
]
# Apply chat template
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Tokenize
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(model.device)
# Generate response
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
)
# Decode
output = tokenizer.decode(output_ids[0], skip_special_tokens=True)
# Extract just the generated response
response_start = output.find(input_text) + len(input_text)
generated_response = output[response_start:].strip()
print(f"Generated response: {{generated_response}}")
import requests
API_URL = "https://api-inference.huggingface.co/models/aryashah00/survey-finetuned-Mistral-7B-Instruct-v0.3"
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)
This model follows the license of the base model mistralai/Mistral-7B-Instruct-v0.3.