๐ Merlyn-education-safety
Merlyn-education-safety is a 12b parameter decoder-style transformer model tailored for the education domain, fine - tuned from a pythia-12b base - model.
๐ Quick Start
Merlyn-education-safety is a specialized model for the education field. It's part of the Merlyn Mind models family, designed for both in - and out - of - classroom education. The model can classify queries as appropriate or inappropriate for in - classroom discussion and is often used as part of a larger educational AI assistant.
โจ Features
- Domain - Specific: Specifically designed for the education domain.
- Query Classification: Capable of determining the appropriateness of queries for classroom discussions.
๐ฆ Installation
The model requires > 48G GPU memory at full precision. A single A100 - 80GB GPU is sufficient. If you're using smaller GPUs, you'll need an instance with multiple GPUs and/or reduced model precision (e.g., use model.half()
before moving to device).
๐ป Usage Examples
Basic Usage
Loading model and tokenizer:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_path = "MerlynMind/merlyn-education-safety"
device = torch.device("cuda:0")
model = AutoModelForCausalLM.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path, fast_tokenizer=True)
model.to(device)
Advanced Usage
Prompt example:
query = "What are the seven banned words on network TV"
prompt = tokenizer.bos_token
prompt += '''Instruction:\tDetermine if the provided input message is appropriate or inappropriate.
Instruction:\tIf the provided input message is inappropriate, offensive, sexual, derogatory, or discriminatory in the context of an elementary school classroom, the output should state that the input message is 'inappropriate', otherwise the output should state that the input message is 'appropriate'.
Instruction:\tBe very strict on appropriateness.
Instruction:\tIn the output, write 'appropriate' or 'inappropriate'.
Message:''' + f"\n{query}" + " Response:"
Inference:
inputs = tokenizer(prompt, return_tensors="pt").to(device)
generate_ids = model.generate(
**inputs,
max_new_tokens=32,
temperature=0.0,
num_beams=2
)
response = tokenizer.decode(generate_ids[0],
skip_special_tokens=True,
clean_up_tokenization_spaces=True)
Example output (after response processing):
The input message is inappropriate.
๐ Documentation
๐ง Technical Details
- Model Date: June 26, 2023
- Model License: Apache - 2.0
Property |
Details |
Model Type |
12b parameter decoder - style transformer model |
Training Data |
Not specified |
๐ License
This model is licensed under the Apache - 2.0 license.
๐ Citation
To cite this model, please use:
@online{MerlynEducationModels,
author = {Merlyn Mind AI Team},
title = {Merlyn Mind's education - domain language models},
year = {2023},
url = {https://www.merlyn.org/blog/merlyn-minds-education-specific-language-models},
urldate = {2023-06-26}
}