🚀 CodeTrans模型用於API推薦生成
CodeTrans模型基於t5基礎模型架構,是一個預訓練模型,可用於API推薦生成。該模型首次發佈於this repository。
🚀 快速開始
此模型可用於生成Java編程任務的API使用示例。以下是使用Transformers的SummarizationPipeline生成Java函數文檔的示例:
from transformers import AutoTokenizer, AutoModelWithLMHead, SummarizationPipeline
pipeline = SummarizationPipeline(
model=AutoModelWithLMHead.from_pretrained("SEBIS/code_trans_t5_base_api_generation"),
tokenizer=AutoTokenizer.from_pretrained("SEBIS/code_trans_t5_base_api_generation", skip_special_tokens=True),
device=0
)
tokenized_code = "parse the uses licence node of this package , if any , and returns the license definition if theres"
pipeline([tokenized_code])
你可以在colab notebook中運行此示例。
✨ 主要特性
- 基於
t5-base
模型,擁有自己的SentencePiece詞彙模型。
- 在API推薦生成數據集上進行單任務訓練。
📦 安裝指南
文檔未提及具體安裝步驟,可參考原項目倉庫的相關說明。
💻 使用示例
基礎用法
from transformers import AutoTokenizer, AutoModelWithLMHead, SummarizationPipeline
pipeline = SummarizationPipeline(
model=AutoModelWithLMHead.from_pretrained("SEBIS/code_trans_t5_base_api_generation"),
tokenizer=AutoTokenizer.from_pretrained("SEBIS/code_trans_t5_base_api_generation", skip_special_tokens=True),
device=0
)
tokenized_code = "parse the uses licence node of this package , if any , and returns the license definition if theres"
pipeline([tokenized_code])
高級用法
文檔未提供高級用法示例,可根據實際需求對基礎用法進行擴展。
📚 詳細文檔
模型描述
該CodeTrans模型基於t5-base
模型,具備自己的SentencePiece詞彙模型,在API推薦生成數據集上進行了單任務訓練。
預期用途和限制
此模型可用於生成Java編程任務的API使用示例。
訓練數據
有監督的訓練任務數據集可在Link下載。
評估結果
對於代碼文檔任務,不同模型在不同編程語言上(以BLEU分數衡量)取得了以下結果:
語言/模型 |
Java |
CodeTrans - ST - Small |
68.71 |
CodeTrans - ST - Base |
70.45 |
CodeTrans - TF - Small |
68.90 |
CodeTrans - TF - Base |
72.11 |
CodeTrans - TF - Large |
73.26 |
CodeTrans - MT - Small |
58.43 |
CodeTrans - MT - Base |
67.97 |
CodeTrans - MT - Large |
72.29 |
CodeTrans - MT - TF - Small |
69.29 |
CodeTrans - MT - TF - Base |
72.89 |
CodeTrans - MT - TF - Large |
73.39 |
現有最優模型 |
54.42 |
📄 許可證
文檔未提及許可證信息。
由 Ahmed Elnaggar | LinkedIn 和 Wei Ding | LinkedIn 創建