Instructions to use gagan3012/project-code-py-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gagan3012/project-code-py-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gagan3012/project-code-py-small")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("gagan3012/project-code-py-small") model = AutoModelForCausalLM.from_pretrained("gagan3012/project-code-py-small", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gagan3012/project-code-py-small with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gagan3012/project-code-py-small" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gagan3012/project-code-py-small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/gagan3012/project-code-py-small
- SGLang
How to use gagan3012/project-code-py-small 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 "gagan3012/project-code-py-small" \ --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": "gagan3012/project-code-py-small", "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 "gagan3012/project-code-py-small" \ --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": "gagan3012/project-code-py-small", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use gagan3012/project-code-py-small with Docker Model Runner:
docker model run hf.co/gagan3012/project-code-py-small
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# keytotext
|
| 2 |
+
|
| 3 |
+
Idea is to build a model which will take keywords as inputs and generate sentences as outputs.
|
| 4 |
+
|
| 5 |
+
### Model:
|
| 6 |
+
|
| 7 |
+
Two Models have been built:
|
| 8 |
+
|
| 9 |
+
- Using T5-base size = 850 MB can be found here: https://huggingface.co/gagan3012/keytotext
|
| 10 |
+
- Using T5-small size = 230 MB can be found here: https://huggingface.co/gagan3012/keytotext-small
|
| 11 |
+
|
| 12 |
+
#### Usage:
|
| 13 |
+
|
| 14 |
+
```python
|
| 15 |
+
from transformers import AutoTokenizer, AutoModelWithLMHead
|
| 16 |
+
|
| 17 |
+
tokenizer = AutoTokenizer.from_pretrained("gagan3012/keytotext-small")
|
| 18 |
+
|
| 19 |
+
model = AutoModelWithLMHead.from_pretrained("gagan3012/keytotext-small")
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
### Demo:
|
| 23 |
+
|
| 24 |
+
[](https://share.streamlit.io/gagan3012/keytotext/app.py)
|
| 25 |
+
|
| 26 |
+
https://share.streamlit.io/gagan3012/keytotext/app.py
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
### Example:
|
| 32 |
+
|
| 33 |
+
['India', 'Wedding'] -> We are celebrating today in New Delhi with three wedding anniversary parties.
|