Instructions to use monsoon-nlp/gpt-nyc-nontoxic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use monsoon-nlp/gpt-nyc-nontoxic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="monsoon-nlp/gpt-nyc-nontoxic")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("monsoon-nlp/gpt-nyc-nontoxic") model = AutoModelForCausalLM.from_pretrained("monsoon-nlp/gpt-nyc-nontoxic", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use monsoon-nlp/gpt-nyc-nontoxic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "monsoon-nlp/gpt-nyc-nontoxic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "monsoon-nlp/gpt-nyc-nontoxic", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/monsoon-nlp/gpt-nyc-nontoxic
- SGLang
How to use monsoon-nlp/gpt-nyc-nontoxic 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 "monsoon-nlp/gpt-nyc-nontoxic" \ --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": "monsoon-nlp/gpt-nyc-nontoxic", "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 "monsoon-nlp/gpt-nyc-nontoxic" \ --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": "monsoon-nlp/gpt-nyc-nontoxic", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use monsoon-nlp/gpt-nyc-nontoxic with Docker Model Runner:
docker model run hf.co/monsoon-nlp/gpt-nyc-nontoxic
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
GPT-NYC-nontoxic
About
GPT2 (small version on HF) fine-tuned on questions and responses from https://reddit.com/r/asknyc
I filtered comments to ones with scores >= 3, and responding directly to the original post ( = ignoring responses to other commenters). I also added many tokens which were common on /r/AskNYC but missing from GPT2.
Additional and tokens control following output. Toxic comments (about 5.5% of input data) are those which were flagged by Perspective API with toxicity > 0.7, or by English DeHateBERT, with tagging for all comments related to LGBTQ identity to avoid false positives / more aggressive censorship from these classifiers.
Try prompting with question? - additional info %% <Toxic>
Or question? - additional info %% <NonToxic>
Other options
The gpt-nyc-small repo is based on GPT2 [small] but without the and tags. It is the most directly comparable model to this one.
The main gpt-nyc repo is based on GPT2-Medium and comes off more accurate. It does not have Toxic/NonToxic tagging.
Blog
Initial model: https://mapmeld.medium.com/gpt-nyc-part-1-9cb698b2e3d
Notebooks
Data processing / new tokens
https://colab.research.google.com/drive/13BOw0uekoAYB4jjQtaXTn6J_VHatiRLu
Fine-tuning GPT2 (small)
https://colab.research.google.com/drive/1FnXcAh4H-k8dAzixkV5ieygV96ePh3lR
Predictive text and probabilities
Scroll to end of
https://colab.research.google.com/drive/1FnXcAh4H-k8dAzixkV5ieygV96ePh3lR
to see how to install git-lfs and trick ecco into loading this.
- Downloads last month
- 20