Text Generation
Transformers
PyTorch
Safetensors
English
gpt2
simplification
text-generation-inference
Instructions to use philippelaban/keep_it_simple with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use philippelaban/keep_it_simple with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="philippelaban/keep_it_simple")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("philippelaban/keep_it_simple") model = AutoModelForCausalLM.from_pretrained("philippelaban/keep_it_simple") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use philippelaban/keep_it_simple with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "philippelaban/keep_it_simple" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "philippelaban/keep_it_simple", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/philippelaban/keep_it_simple
- SGLang
How to use philippelaban/keep_it_simple 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 "philippelaban/keep_it_simple" \ --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": "philippelaban/keep_it_simple", "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 "philippelaban/keep_it_simple" \ --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": "philippelaban/keep_it_simple", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use philippelaban/keep_it_simple with Docker Model Runner:
docker model run hf.co/philippelaban/keep_it_simple
Commit ·
60ebd02
1
Parent(s): 219e90d
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
The model can be loaded in the following way:
|
| 2 |
```
|
| 3 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
@@ -7,7 +9,18 @@ tokenizer = AutoTokenizer.from_pretrained("philippelaban/keep_it_simple")
|
|
| 7 |
kis_model = AutoModelForCausalLM.from_pretrained("philippelaban/keep_it_simple")
|
| 8 |
```
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
```
|
| 12 |
paragraph = """A small capsule containing asteroid soil samples that was dropped from 136,700 miles in space by Japan's Hayabusa2 spacecraft landed as planned in the Australian Outback on December 6. The extremely high precision required to carry out the mission thrilled many in Japan, who said they took pride in its success."""
|
| 13 |
|
|
@@ -25,6 +38,8 @@ for o in output:
|
|
| 25 |
print(o)
|
| 26 |
```
|
| 27 |
|
|
|
|
|
|
|
| 28 |
When run, an output similar to the following should be obtained:
|
| 29 |
|
| 30 |
A small capsule containing samples of asteroid soil that was dropped from 136,700 miles, Japan's Hayabusa2 space probe, landed as planned on December 6. The mission was extremely precise, said many in Japan, and they took pride in its success.
|
|
@@ -33,4 +48,9 @@ A small capsule containing samples of asteroid soil that was dropped from 136,70
|
|
| 33 |
|
| 34 |
A small capsule containing soil samples that was dropped from 136,700 miles, Japan's Hayabusa2 space probe, landed as planned on December 6. The mission was designed to test the performance of the country's space fleet, which many said took pride in its success.
|
| 35 |
|
| 36 |
-
A small capsule containing soil samples that was dropped from 136,700 miles in space by Japan's Hayabusa2 probe was followed by a landing on the Outback. The precise timing of the mission thrilled many in Japan, who said they took pride in its success.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Model Loading
|
| 2 |
+
|
| 3 |
The model can be loaded in the following way:
|
| 4 |
```
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
|
| 9 |
kis_model = AutoModelForCausalLM.from_pretrained("philippelaban/keep_it_simple")
|
| 10 |
```
|
| 11 |
|
| 12 |
+
# Example use
|
| 13 |
+
|
| 14 |
+
And then used by first inputting a paragraph for simplification, followed by a `bos_token` to indicate to the model to start simplifying.
|
| 15 |
+
Imagine we want to simplify the following paragraph:
|
| 16 |
+
```
|
| 17 |
+
A small capsule containing asteroid soil samples that was dropped from 136,700 miles in space
|
| 18 |
+
by Japan's Hayabusa2 spacecraft landed as planned in the Australian Outback on December 6.
|
| 19 |
+
The extremely high precision required to carry out the mission thrilled many in Japan,
|
| 20 |
+
who said they took pride in its success.
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
The following code can be run:
|
| 24 |
```
|
| 25 |
paragraph = """A small capsule containing asteroid soil samples that was dropped from 136,700 miles in space by Japan's Hayabusa2 spacecraft landed as planned in the Australian Outback on December 6. The extremely high precision required to carry out the mission thrilled many in Japan, who said they took pride in its success."""
|
| 26 |
|
|
|
|
| 38 |
print(o)
|
| 39 |
```
|
| 40 |
|
| 41 |
+
# Example output
|
| 42 |
+
|
| 43 |
When run, an output similar to the following should be obtained:
|
| 44 |
|
| 45 |
A small capsule containing samples of asteroid soil that was dropped from 136,700 miles, Japan's Hayabusa2 space probe, landed as planned on December 6. The mission was extremely precise, said many in Japan, and they took pride in its success.
|
|
|
|
| 48 |
|
| 49 |
A small capsule containing soil samples that was dropped from 136,700 miles, Japan's Hayabusa2 space probe, landed as planned on December 6. The mission was designed to test the performance of the country's space fleet, which many said took pride in its success.
|
| 50 |
|
| 51 |
+
A small capsule containing soil samples that was dropped from 136,700 miles in space by Japan's Hayabusa2 probe was followed by a landing on the Outback. The precise timing of the mission thrilled many in Japan, who said they took pride in its success.
|
| 52 |
+
|
| 53 |
+
# Github repo
|
| 54 |
+
|
| 55 |
+
You can access more information, access to the scoring function, the training script, or an example training log on the Github repo:
|
| 56 |
+
https://github.com/tingofurro/keep_it_simple
|