Instructions to use AndyReas/GenNewsGPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AndyReas/GenNewsGPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AndyReas/GenNewsGPT")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AndyReas/GenNewsGPT") model = AutoModelForCausalLM.from_pretrained("AndyReas/GenNewsGPT") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use AndyReas/GenNewsGPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AndyReas/GenNewsGPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AndyReas/GenNewsGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AndyReas/GenNewsGPT
- SGLang
How to use AndyReas/GenNewsGPT 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 "AndyReas/GenNewsGPT" \ --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": "AndyReas/GenNewsGPT", "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 "AndyReas/GenNewsGPT" \ --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": "AndyReas/GenNewsGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AndyReas/GenNewsGPT with Docker Model Runner:
docker model run hf.co/AndyReas/GenNewsGPT
NewsGPT
Model Description
The model is the gpt2 fine-tuned to generate news.
Training Data
The model's training data consists of ~13,000,000 English articles from ~90 outlets, which each consists of a headline (title) and a subheading (description). The articles were collected from the Sciride News Mine, after which some additional cleaning was performed on the data, such as removing duplicate articles and removing repeated "outlet tags" appearing before or after headlines such as "| Daily Mail Online".
The cleaned dataset can be found on huggingface here. The data was repacked before training, to avoid abrupt truncation, which altered the order of the data a bit but it is ultimately the same sentences.
How to use
The model can be used with the HuggingFace pipeline like so:
>>> from transformers import pipeline
>>> generator = pipeline('text-generation', model='andyreas/gennewsgpt')
>>> generator("COVID-19 is", max_length=50, num_return_sequences=2)
[{'generated_text': "COVID-19 is killing more people than the coronavirus. The number of people who have been infected has more than doubled in the past decade, according to a new analysis.The study of 2,000 people by the University of California.The study by"},
{'generated_text': "COVID-19 is the worst thing to happen in Canada: A new study. A new study suggests that the COVID-19 pandemic has become the \"best thing to happen in Canada.\". But the pandemic has also been a long-term challenge for"}]
The model's config.json file includes default parameters for text-generation, which results in the same prompt producing different outputs. These can be overwritten to generate consistent outputs by setting "do_sample" = False, like so:
>>> generator("COVID-19 is", do_sample=False)
or increase variance by increasing the amount of words considered during sampling, like so:
>>> generator("COVID-19 is", do_sample=True, top_k=50)
Training
Training ran for 1 epoch using a learning rate of 2e-6 and 50K warm-up steps out of ~800K total steps.
Bias
Like any other model, GenNewsGPT is subject to bias according to the data it was trained on.
- Downloads last month
- 3
docker model run hf.co/AndyReas/GenNewsGPT