YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
GPT-OSS-Safeguard-20B Demo
This repository demonstrates the usage of OpenAI's GPT-OSS-Safeguard-20B model for text generation tasks.
Overview
GPT-OSS-Safeguard-20B is a large language model designed for safe and responsible text generation. This project provides a simple implementation using the Hugging Face Transformers library.
Model Information
- Model: openai/gpt-oss-safeguard-20b
- Task: Text Generation
- Framework: Transformers (Hugging Face)
Features
- GPU-accelerated inference using CUDA
- Simple pipeline-based implementation
- Conversational text generation
- Easy-to-use interface for creative writing tasks
Requirements
- Python 3.8+
- CUDA-compatible GPU (recommended)
- Transformers library
- PyTorch
Installation
pip install -U transformers torch
For GPU support, ensure you have CUDA installed and configured properly.
Usage
The notebook demonstrates basic usage:
from transformers import pipeline
# Initialize the pipeline
pipe = pipeline("text-generation", model="openai/gpt-oss-safeguard-20b")
# Create a conversation
messages = [
{"role": "user", "content": "Can you write a short story about a cat?"},
]
# Generate text
output = pipe(messages)
print(output[0]['generated_text'])
Files
gpt-oss-safeguard-20b.ipynb: Jupyter notebook with example implementation
Notes
- The model uses MXFP4 quantization which requires Triton. If not available, it will default to bf16 dequantization.
- First run will download the model files (~13.76 GB total).
- Inference requires significant GPU memory.
Example Output
The model generates coherent and creative text based on the input prompts. In the example, when asked to write a short story about a cat, the model analyzes the request and begins crafting a narrative with character development and setting details.
Contributing
Feel free to open issues or submit pull requests for improvements.
License
MIT License - See LICENSE file for details.
Acknowledgments
- Model by OpenAI
- Built with Hugging Face Transformers