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, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("intm/codet5-small-go_generation") model = AutoModelForSeq2SeqLM.from_pretrained("intm/codet5-small-go_generation", device_map="auto") - Notebooks
- Google Colab
- Kaggle
add dataset
Browse files- README.md +2 -0
- example_usage.py +1 -0
README.md
CHANGED
|
@@ -4,8 +4,10 @@ license: apache-2.0
|
|
| 4 |
|
| 5 |
# CodeT5-small-Go_generation
|
| 6 |
This model is finetuned based on the pre-trained [CodeT5-small model](https://github.com/salesforce/CodeT5#fine-tuning).
|
|
|
|
| 7 |
|
| 8 |
> 5.3 upload the initial version.
|
|
|
|
| 9 |
|
| 10 |
The model genarates the missing function body according to the input which privides the necessary class environment and an empty function.
|
| 11 |
|
|
|
|
| 4 |
|
| 5 |
# CodeT5-small-Go_generation
|
| 6 |
This model is finetuned based on the pre-trained [CodeT5-small model](https://github.com/salesforce/CodeT5#fine-tuning).
|
| 7 |
+
This model is fine-tuned on dataset: [codet5_go-generation](https://huggingface.co/datasets/intm/codet5_go-generation).
|
| 8 |
|
| 9 |
> 5.3 upload the initial version.
|
| 10 |
+
> 5.6 upload the dataset
|
| 11 |
|
| 12 |
The model genarates the missing function body according to the input which privides the necessary class environment and an empty function.
|
| 13 |
|
example_usage.py
CHANGED
|
@@ -9,6 +9,7 @@ model = T5ForConditionalGeneration.from_pretrained(model_path)
|
|
| 9 |
|
| 10 |
# 使用模型进行推理
|
| 11 |
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"
|
|
|
|
| 12 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
| 13 |
output = model.generate(input_ids=input_ids, max_new_tokens=256) #最大长度按照数据集的max_trg_len设置
|
| 14 |
|
|
|
|
| 9 |
|
| 10 |
# 使用模型进行推理
|
| 11 |
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"
|
| 12 |
+
#input_text="\n\nfunc twoSum(nums []int, target int) []int "
|
| 13 |
input_ids = tokenizer.encode(input_text, return_tensors="pt")
|
| 14 |
output = model.generate(input_ids=input_ids, max_new_tokens=256) #最大长度按照数据集的max_trg_len设置
|
| 15 |
|