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
|