Instructions to use thanushtph/kannada-codet5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thanushtph/kannada-codet5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="thanushtph/kannada-codet5")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("thanushtph/kannada-codet5") model = AutoModelForSeq2SeqLM.from_pretrained("thanushtph/kannada-codet5") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use thanushtph/kannada-codet5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thanushtph/kannada-codet5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thanushtph/kannada-codet5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/thanushtph/kannada-codet5
- SGLang
How to use thanushtph/kannada-codet5 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 "thanushtph/kannada-codet5" \ --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": "thanushtph/kannada-codet5", "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 "thanushtph/kannada-codet5" \ --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": "thanushtph/kannada-codet5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use thanushtph/kannada-codet5 with Docker Model Runner:
docker model run hf.co/thanushtph/kannada-codet5
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: text2text-generation
|
| 3 |
+
library_name: transformers
|
| 4 |
+
language: kn
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Kannada CodeT5
|
| 8 |
+
|
| 9 |
+
This repository hosts a Kannada CodeT5 model fine-tuned for code-related text generation.
|
| 10 |
+
|
| 11 |
+
## Inference
|
| 12 |
+
|
| 13 |
+
```python
|
| 14 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 15 |
+
|
| 16 |
+
model_id = "thanushtph/kannada-codet5"
|
| 17 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 18 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
|
| 19 |
+
|
| 20 |
+
inputs = tokenizer("translate code to Kannada", return_tensors="pt")
|
| 21 |
+
outputs = model.generate(**inputs, max_new_tokens=64)
|
| 22 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Once uploaded, the Hugging Face Inference API can be called via:
|
| 26 |
+
|
| 27 |
+
- POST https://api-inference.huggingface.co/models/thanushtph/kannada-codet5
|