Instructions to use intm/codet5-small-go_generation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use intm/codet5-small-go_generation with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("intm/codet5-small-go_generation") model = AutoModelForMultimodalLM.from_pretrained("intm/codet5-small-go_generation") - Notebooks
- Google Colab
- Kaggle
File size: 1,707 Bytes
dcdff78 0dfdb21 aff105b 0dfdb21 aff105b 0dfdb21 8cb4fad 0dfdb21 12c2cac 0dfdb21 147691d 0dfdb21 12c2cac 0dfdb21 12c2cac 0dfdb21 12c2cac 0dfdb21 8cb4fad 0dfdb21 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ---
license: apache-2.0
---
# CodeT5-small-Go_generation
This model is finetuned based on the pre-trained [CodeT5-small model](https://github.com/salesforce/CodeT5#fine-tuning).
This model is fine-tuned on dataset: [codet5_go-generation](https://huggingface.co/datasets/intm/codet5_go-generation).
> 5.3 upload the initial version.
> 5.6 upload the dataset
The model genarates the missing function body according to the input which privides the necessary class environment and an empty function.
See example below for formatting.
# How to use
Here is how to use this model:
```
from transformers import T5ForConditionalGeneration, RobertaTokenizer
# load model and tokenizer
model_path = "intm/codet5-small-go_generation"
tokenizer = RobertaTokenizer.from_pretrained('intm/codet5-small-go_generation')
model = T5ForConditionalGeneration.from_pretrained(model_path)
# use model to generate code
input_text = "package names\n\nimport \"knative.dev/pkg/kmeta\"\n\n\nfunc Deployment(rev kmeta.Accessor) string {\n\treturn kmeta.ChildName(rev.GetName(), \"-deployment\")\n}\n\n\nfunc ImageCache(rev kmeta.Accessor) string {\n\treturn kmeta.ChildName(rev.GetName(), \"-cache\")\n}\n\n\n\n\nfunc PA(rev kmeta.Accessor) string"
input_ids = tokenizer.encode(input_text, return_tensors="pt")
output = model.generate(input_ids=input_ids, max_new_tokens=256) # max_new_token is same as max_trg_len in dataset
# convert the result to the string
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(output_text)
# this prints "return kmeta.ChildName(rev.GetName(), "-pa")"
```
# Training data
YinShicheng
# Training process
GuQiuhan
# Advisor
Prof.WangYu
# Evaluation results
TODO
|