Instructions to use huggingtweets/berniesanders with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use huggingtweets/berniesanders with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="huggingtweets/berniesanders")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("huggingtweets/berniesanders") model = AutoModelForCausalLM.from_pretrained("huggingtweets/berniesanders") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use huggingtweets/berniesanders with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "huggingtweets/berniesanders" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "huggingtweets/berniesanders", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/huggingtweets/berniesanders
- SGLang
How to use huggingtweets/berniesanders 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 "huggingtweets/berniesanders" \ --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": "huggingtweets/berniesanders", "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 "huggingtweets/berniesanders" \ --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": "huggingtweets/berniesanders", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use huggingtweets/berniesanders with Docker Model Runner:
docker model run hf.co/huggingtweets/berniesanders
New model from https://wandb.ai/wandb/huggingtweets/runs/1w2aztyw
Browse files- README.md +7 -7
- config.json +1 -1
- pytorch_model.bin +2 -2
- special_tokens_map.json +5 -1
- tokenizer.json +6 -3
- tokenizer_config.json +10 -1
- training_args.bin +2 -2
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
language: en
|
| 3 |
-
thumbnail:
|
| 4 |
tags:
|
| 5 |
- huggingtweets
|
| 6 |
widget:
|
|
@@ -43,19 +43,19 @@ The model was trained on tweets from Bernie Sanders.
|
|
| 43 |
| Data | Bernie Sanders |
|
| 44 |
| --- | --- |
|
| 45 |
| Tweets downloaded | 3250 |
|
| 46 |
-
| Retweets |
|
| 47 |
-
| Short tweets |
|
| 48 |
-
| Tweets kept |
|
| 49 |
|
| 50 |
-
[Explore the data](https://wandb.ai/wandb/huggingtweets/runs/
|
| 51 |
|
| 52 |
## Training procedure
|
| 53 |
|
| 54 |
The model is based on a pre-trained [GPT-2](https://huggingface.co/gpt2) which is fine-tuned on @berniesanders's tweets.
|
| 55 |
|
| 56 |
-
Hyperparameters and metrics are recorded in the [W&B training run](https://wandb.ai/wandb/huggingtweets/runs/
|
| 57 |
|
| 58 |
-
At the end of training, [the final model](https://wandb.ai/wandb/huggingtweets/runs/
|
| 59 |
|
| 60 |
## How to use
|
| 61 |
|
|
|
|
| 1 |
---
|
| 2 |
language: en
|
| 3 |
+
thumbnail: https://github.com/borisdayma/huggingtweets/blob/master/img/logo.png?raw=true
|
| 4 |
tags:
|
| 5 |
- huggingtweets
|
| 6 |
widget:
|
|
|
|
| 43 |
| Data | Bernie Sanders |
|
| 44 |
| --- | --- |
|
| 45 |
| Tweets downloaded | 3250 |
|
| 46 |
+
| Retweets | 387 |
|
| 47 |
+
| Short tweets | 7 |
|
| 48 |
+
| Tweets kept | 2856 |
|
| 49 |
|
| 50 |
+
[Explore the data](https://wandb.ai/wandb/huggingtweets/runs/1peyp14p/artifacts), which is tracked with [W&B artifacts](https://docs.wandb.com/artifacts) at every step of the pipeline.
|
| 51 |
|
| 52 |
## Training procedure
|
| 53 |
|
| 54 |
The model is based on a pre-trained [GPT-2](https://huggingface.co/gpt2) which is fine-tuned on @berniesanders's tweets.
|
| 55 |
|
| 56 |
+
Hyperparameters and metrics are recorded in the [W&B training run](https://wandb.ai/wandb/huggingtweets/runs/1w2aztyw) for full transparency and reproducibility.
|
| 57 |
|
| 58 |
+
At the end of training, [the final model](https://wandb.ai/wandb/huggingtweets/runs/1w2aztyw/artifacts) is logged and versioned.
|
| 59 |
|
| 60 |
## How to use
|
| 61 |
|
config.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
| 37 |
}
|
| 38 |
},
|
| 39 |
"torch_dtype": "float32",
|
| 40 |
-
"transformers_version": "4.
|
| 41 |
"use_cache": true,
|
| 42 |
"vocab_size": 50257
|
| 43 |
}
|
|
|
|
| 37 |
}
|
| 38 |
},
|
| 39 |
"torch_dtype": "float32",
|
| 40 |
+
"transformers_version": "4.21.2",
|
| 41 |
"use_cache": true,
|
| 42 |
"vocab_size": 50257
|
| 43 |
}
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:341d5ea1086be318ceca568a34e702b47ddaa2379edeaf3d03e2ae58595d98a1
|
| 3 |
+
size 510396521
|
special_tokens_map.json
CHANGED
|
@@ -1 +1,5 @@
|
|
| 1 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "<|endoftext|>",
|
| 3 |
+
"eos_token": "<|endoftext|>",
|
| 4 |
+
"unk_token": "<|endoftext|>"
|
| 5 |
+
}
|
tokenizer.json
CHANGED
|
@@ -17,17 +17,20 @@
|
|
| 17 |
"pre_tokenizer": {
|
| 18 |
"type": "ByteLevel",
|
| 19 |
"add_prefix_space": false,
|
| 20 |
-
"trim_offsets": true
|
|
|
|
| 21 |
},
|
| 22 |
"post_processor": {
|
| 23 |
"type": "ByteLevel",
|
| 24 |
"add_prefix_space": true,
|
| 25 |
-
"trim_offsets": false
|
|
|
|
| 26 |
},
|
| 27 |
"decoder": {
|
| 28 |
"type": "ByteLevel",
|
| 29 |
"add_prefix_space": true,
|
| 30 |
-
"trim_offsets": true
|
|
|
|
| 31 |
},
|
| 32 |
"model": {
|
| 33 |
"type": "BPE",
|
|
|
|
| 17 |
"pre_tokenizer": {
|
| 18 |
"type": "ByteLevel",
|
| 19 |
"add_prefix_space": false,
|
| 20 |
+
"trim_offsets": true,
|
| 21 |
+
"use_regex": true
|
| 22 |
},
|
| 23 |
"post_processor": {
|
| 24 |
"type": "ByteLevel",
|
| 25 |
"add_prefix_space": true,
|
| 26 |
+
"trim_offsets": false,
|
| 27 |
+
"use_regex": true
|
| 28 |
},
|
| 29 |
"decoder": {
|
| 30 |
"type": "ByteLevel",
|
| 31 |
"add_prefix_space": true,
|
| 32 |
+
"trim_offsets": true,
|
| 33 |
+
"use_regex": true
|
| 34 |
},
|
| 35 |
"model": {
|
| 36 |
"type": "BPE",
|
tokenizer_config.json
CHANGED
|
@@ -1 +1,10 @@
|
|
| 1 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"bos_token": "<|endoftext|>",
|
| 4 |
+
"eos_token": "<|endoftext|>",
|
| 5 |
+
"model_max_length": 1024,
|
| 6 |
+
"name_or_path": "gpt2",
|
| 7 |
+
"special_tokens_map_file": null,
|
| 8 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 9 |
+
"unk_token": "<|endoftext|>"
|
| 10 |
+
}
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:df79043cf60173386ec6c83e6c3c7dfb65550b1ece70b4ed885b16e46b88e46f
|
| 3 |
+
size 3375
|