Text Generation
Transformers
PyTorch
JAX
TensorBoard
Safetensors
Swedish
gpt2
text-generation-inference
Instructions to use flax-community/swe-gpt-wiki with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flax-community/swe-gpt-wiki with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="flax-community/swe-gpt-wiki")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("flax-community/swe-gpt-wiki") model = AutoModelForCausalLM.from_pretrained("flax-community/swe-gpt-wiki", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use flax-community/swe-gpt-wiki with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flax-community/swe-gpt-wiki" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flax-community/swe-gpt-wiki", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/flax-community/swe-gpt-wiki
- SGLang
How to use flax-community/swe-gpt-wiki 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 "flax-community/swe-gpt-wiki" \ --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": "flax-community/swe-gpt-wiki", "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 "flax-community/swe-gpt-wiki" \ --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": "flax-community/swe-gpt-wiki", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use flax-community/swe-gpt-wiki with Docker Model Runner:
docker model run hf.co/flax-community/swe-gpt-wiki
Commit ·
455a257
1
Parent(s): c8213eb
Updated model
Browse files- added_tokens.json +1 -0
- config.json +2 -1
- evaluate.py +8 -0
- merges.txt +0 -0
- pytorch_model.bin +2 -2
- save_model.py +8 -6
- special_tokens_map.json +1 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
added_tokens.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"<|endoftext|>": 50265}
|
config.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"activation_function": "gelu_new",
|
| 3 |
"architectures": [
|
| 4 |
-
"
|
| 5 |
],
|
| 6 |
"attn_pdrop": 0.0,
|
| 7 |
"bos_token_id": 50256,
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": ".",
|
| 3 |
"activation_function": "gelu_new",
|
| 4 |
"architectures": [
|
| 5 |
+
"GPT2LMHeadModel"
|
| 6 |
],
|
| 7 |
"attn_pdrop": 0.0,
|
| 8 |
"bos_token_id": 50256,
|
evaluate.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import GPT2Tokenizer, GPT2Model, pipeline, set_seed
|
| 2 |
+
|
| 3 |
+
tokenizer = GPT2Tokenizer.from_pretrained("flax-community/swe-gpt-wiki")
|
| 4 |
+
model = GPT2Model.from_pretrained("flax-community/swe-gpt-wiki")
|
| 5 |
+
|
| 6 |
+
generator = pipeline('text-generation', model=model)
|
| 7 |
+
set_seed(42)
|
| 8 |
+
generator("Hej, jag är en språkmodell,", max_length=30, num_return_sequences=5)
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
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:226e91a5056e14d4bf8079bfc261958fbf6d8ec09a834091235ba01ca5fbf88e
|
| 3 |
+
size 510401385
|
save_model.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
-
from transformers
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
model.save_pretrained(".
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoTokenizer, GPT2LMHeadModel
|
| 2 |
+
'''
|
| 3 |
+
This is a script to convert the Jax model and the tokenizer to Pytorch model
|
| 4 |
+
'''
|
| 5 |
+
model = GPT2LMHeadModel.from_pretrained(".", from_flax=True)
|
| 6 |
+
model.save_pretrained(".")
|
| 7 |
+
tokenizer = AutoTokenizer.from_pretrained(".")
|
| 8 |
+
tokenizer.save_pretrained(".")
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "unk_token": "<|endoftext|>"}
|
tokenizer.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"unk_token": "<|endoftext|>", "bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "add_prefix_space": false, "special_tokens_map_file": null, "name_or_path": ".", "tokenizer_class": "GPT2Tokenizer"}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|