Text Generation
Transformers
Safetensors
English
t5
text2text-generation
code
java
codet5
optimization
code-generation
text-generation-inference
Instructions to use nlpctx/codet5-java-optimizer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nlpctx/codet5-java-optimizer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nlpctx/codet5-java-optimizer")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("nlpctx/codet5-java-optimizer") model = AutoModelForMultimodalLM.from_pretrained("nlpctx/codet5-java-optimizer") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nlpctx/codet5-java-optimizer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nlpctx/codet5-java-optimizer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nlpctx/codet5-java-optimizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nlpctx/codet5-java-optimizer
- SGLang
How to use nlpctx/codet5-java-optimizer 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 "nlpctx/codet5-java-optimizer" \ --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": "nlpctx/codet5-java-optimizer", "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 "nlpctx/codet5-java-optimizer" \ --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": "nlpctx/codet5-java-optimizer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nlpctx/codet5-java-optimizer with Docker Model Runner:
docker model run hf.co/nlpctx/codet5-java-optimizer
Unknown Haas commited on
Commit ·
2f9309e
1
Parent(s): c5bb003
Add HF metadata, links, and Apache 2.0 license
Browse files
README.md
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# CodeT5-small Java Optimization Model
|
| 2 |
|
| 3 |
-
A fine-tuned Salesforce/codet5-small model for Java code optimization tasks.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
## Overview
|
| 6 |
|
|
@@ -28,12 +51,12 @@ This repository contains a fine-tuned CodeT5-small model specifically trained fo
|
|
| 28 |
## Usage
|
| 29 |
|
| 30 |
```python
|
| 31 |
-
from transformers import T5ForConditionalGeneration,
|
| 32 |
import torch
|
| 33 |
|
| 34 |
# Load model and tokenizer
|
| 35 |
-
model = T5ForConditionalGeneration.from_pretrained("
|
| 36 |
-
tokenizer =
|
| 37 |
|
| 38 |
# Prepare input Java code
|
| 39 |
java_code = "your Java code here"
|
|
@@ -73,10 +96,10 @@ The model was fine-tuned using:
|
|
| 73 |
|
| 74 |
## License
|
| 75 |
|
| 76 |
-
This model is
|
| 77 |
|
| 78 |
## Acknowledgements
|
| 79 |
|
| 80 |
-
- Model based on Salesforce/codet5-small
|
| 81 |
-
- Training data from nlpctx/java_optimisation dataset
|
| 82 |
-
- Built with HuggingFace Transformers
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- code
|
| 7 |
+
- java
|
| 8 |
+
- codet5
|
| 9 |
+
- optimization
|
| 10 |
+
- code-generation
|
| 11 |
+
datasets:
|
| 12 |
+
- nlpctx/java_optimisation
|
| 13 |
+
base_model: Salesforce/codet5-small
|
| 14 |
+
pipeline_tag: text2text-generation
|
| 15 |
+
model-index:
|
| 16 |
+
- name: codet5-java-optimizer
|
| 17 |
+
results: []
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
# CodeT5-small Java Optimization Model
|
| 21 |
|
| 22 |
+
A fine-tuned [Salesforce/codet5-small](https://huggingface.co/Salesforce/codet5-small) model for Java code optimization tasks.
|
| 23 |
+
|
| 24 |
+
- **Model**: [nlpctx/codet5-java-optimizer](https://huggingface.co/nlpctx/codet5-java-optimizer)
|
| 25 |
+
- **Dataset**: [nlpctx/java_optimisation](https://huggingface.co/datasets/nlpctx/java_optimisation)
|
| 26 |
+
- **Base Model**: [Salesforce/codet5-small](https://huggingface.co/Salesforce/codet5-small)
|
| 27 |
|
| 28 |
## Overview
|
| 29 |
|
|
|
|
| 51 |
## Usage
|
| 52 |
|
| 53 |
```python
|
| 54 |
+
from transformers import T5ForConditionalGeneration, RobertaTokenizer
|
| 55 |
import torch
|
| 56 |
|
| 57 |
# Load model and tokenizer
|
| 58 |
+
model = T5ForConditionalGeneration.from_pretrained("nlpctx/codet5-java-optimizer")
|
| 59 |
+
tokenizer = RobertaTokenizer.from_pretrained("nlpctx/codet5-java-optimizer")
|
| 60 |
|
| 61 |
# Prepare input Java code
|
| 62 |
java_code = "your Java code here"
|
|
|
|
| 96 |
|
| 97 |
## License
|
| 98 |
|
| 99 |
+
This model is licensed under the **Apache 2.0** license, matching the original [Salesforce/codet5-small](https://huggingface.co/Salesforce/codet5-small) model.
|
| 100 |
|
| 101 |
## Acknowledgements
|
| 102 |
|
| 103 |
+
- Model based on [Salesforce/codet5-small](https://huggingface.co/Salesforce/codet5-small)
|
| 104 |
+
- Training data from [nlpctx/java_optimisation](https://huggingface.co/datasets/nlpctx/java_optimisation) dataset
|
| 105 |
+
- Built with [HuggingFace Transformers](https://github.com/huggingface/transformers)
|