Text Generation
Transformers
PyTorch
English
gpt2
gender bias
debias
fine-tune
llm
text-generation-inference
Instructions to use iabhijith/GPT2-small-debiased with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iabhijith/GPT2-small-debiased with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iabhijith/GPT2-small-debiased")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("iabhijith/GPT2-small-debiased") model = AutoModelForCausalLM.from_pretrained("iabhijith/GPT2-small-debiased") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use iabhijith/GPT2-small-debiased with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iabhijith/GPT2-small-debiased" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iabhijith/GPT2-small-debiased", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/iabhijith/GPT2-small-debiased
- SGLang
How to use iabhijith/GPT2-small-debiased 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 "iabhijith/GPT2-small-debiased" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iabhijith/GPT2-small-debiased", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "iabhijith/GPT2-small-debiased" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iabhijith/GPT2-small-debiased", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use iabhijith/GPT2-small-debiased with Docker Model Runner:
docker model run hf.co/iabhijith/GPT2-small-debiased
Top-10 attention heads causing gender bias have been identified using DiffMask+, as proposed in the paper "Identifying and Adapting Transformer-Components Responsible for Gender Bias in an English Language Model." The model was fine-tuned using the Balanced BUG dataset (Levy et al., 2021).
- Downloads last month
- 8