Instructions to use himanshu-dutta/pycoder-gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use himanshu-dutta/pycoder-gpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="himanshu-dutta/pycoder-gpt2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("himanshu-dutta/pycoder-gpt2") model = AutoModelForCausalLM.from_pretrained("himanshu-dutta/pycoder-gpt2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use himanshu-dutta/pycoder-gpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "himanshu-dutta/pycoder-gpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "himanshu-dutta/pycoder-gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/himanshu-dutta/pycoder-gpt2
- SGLang
How to use himanshu-dutta/pycoder-gpt2 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 "himanshu-dutta/pycoder-gpt2" \ --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": "himanshu-dutta/pycoder-gpt2", "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 "himanshu-dutta/pycoder-gpt2" \ --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": "himanshu-dutta/pycoder-gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use himanshu-dutta/pycoder-gpt2 with Docker Model Runner:
docker model run hf.co/himanshu-dutta/pycoder-gpt2
Commit ·
c254eaf
1
Parent(s): bbedae3
bumped the model to 10 epoch trained version
Browse files- README.md +4 -0
- added_tokens.json +1 -1
- config.json +1 -1
- pytorch_model.bin +1 -1
README.md
CHANGED
|
@@ -8,6 +8,10 @@
|
|
| 8 |
|
| 9 |
<img alt="Medium" src="https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white" height=28 style="display:inline; height:28px;"/>
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
[](https://pypi.org/project/pycoder/)
|
| 12 |
</div>
|
| 13 |
|
|
|
|
| 8 |
|
| 9 |
<img alt="Medium" src="https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white" height=28 style="display:inline; height:28px;"/>
|
| 10 |
|
| 11 |
+
<a href="https://wandb.ai/himanshu-dutta/pycoder">
|
| 12 |
+
<img alt="WandB Dashboard" src="https://raw.githubusercontent.com/wandb/assets/04cfa58cc59fb7807e0423187a18db0c7430bab5/wandb-github-badge-28.svg" height=28 style="display:inline; height:28px;" />
|
| 13 |
+
</a>
|
| 14 |
+
|
| 15 |
[](https://pypi.org/project/pycoder/)
|
| 16 |
</div>
|
| 17 |
|
added_tokens.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"<|
|
|
|
|
| 1 |
+
{"<|BOS|>": 50257, "<|EOS|>": 50258, "<|UNK|>": 50259, "<|PAD|>": 50260, "<|SEP|>": 50261}
|
config.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
| 35 |
"max_length": 50
|
| 36 |
}
|
| 37 |
},
|
| 38 |
-
"transformers_version": "4.6.
|
| 39 |
"use_cache": true,
|
| 40 |
"vocab_size": 50262
|
| 41 |
}
|
|
|
|
| 35 |
"max_length": 50
|
| 36 |
}
|
| 37 |
},
|
| 38 |
+
"transformers_version": "4.6.1",
|
| 39 |
"use_cache": true,
|
| 40 |
"vocab_size": 50262
|
| 41 |
}
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1444609955
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8d3dff166a58d8be76fd7b0b191eee26330a6c1f3ac363e0bdb78430ae48345
|
| 3 |
size 1444609955
|