Open
Conversation
pskun
requested changes
Dec 30, 2022
| python gts_engine/gts_engine_inference.py \ | ||
| --task_dir=$TASK_DIR \ | ||
| --engine_type=qiankunding \ | ||
| --task_type=generation \ |
Collaborator
There was a problem hiding this comment.
task type改成keyphrase_generation
| --engine_type=qiankunding \ | ||
| --train_mode=standard \ | ||
| --task_dir=$TASK_DIR \ | ||
| --task_type=generation \ |
Collaborator
There was a problem hiding this comment.
task type改成keyphrase_generation
| --data_dir=$WORK_DIR/examples/text_generation \ | ||
| --save_path=$TASK_DIR/outputs \ | ||
| --pretrained_model_dir=$PRETRAINED_DIR \ | ||
| --train_batchsize=32 \ |
| @@ -0,0 +1,141 @@ | |||
| import json | |||
Collaborator
There was a problem hiding this comment.
目录改成:gts_engine/qiankunding/dataloaders/keyphrase_generation
| @@ -0,0 +1,181 @@ | |||
| from genericpath import exists | |||
Collaborator
There was a problem hiding this comment.
改成:gts_engine/qiankunding/models/keyphrase_generation
| logger = Logger().get_log() | ||
|
|
||
|
|
||
| class T5KG(BaseModel): |
Collaborator
There was a problem hiding this comment.
叫KeyphraseGenerationT5吧,本身单词也不长
| inputs = self.train_inputs(batch) | ||
| outputs = self.model.generate( | ||
| input_ids = inputs['input_ids'], | ||
| max_length = 32, |
|
|
||
| outputs = self.model.generate( | ||
| input_ids = inputs['input_ids'], | ||
| max_length=32 |
| self.save_to_file(data_set, results, y_true, y_pred) | ||
|
|
||
| results.append(pred) | ||
| TP, total_pred, total_true = 0, 0, 0 |
Collaborator
There was a problem hiding this comment.
这里的计算和前面模型的validation_step差不多,为啥不单独抽象出一个公共的函数
| special_tokens += [f"[choice{i+1}]" for i in range(200)] | ||
| # special_tokens += [f"{i+1}" for i in range(200)] | ||
|
|
||
| print("pretrained_model_path", pretrained_model_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1.增加Keyphrase Generation项目

2.在examples/text_generation/ 新增 Keyphrase Generation的启动项 以及少量数据
3.新增gts_engine/pipelines/qiankunding_generation.py 主代码
3.新增gts_engine/qiankunding/dataloaders/text_generation/dataloader_kgt5.py的数据处理代码
4.新增gts_engine/qiankunding/models/text_generation/t5_kg.py 模型代码
5.在gts_engine/qiankunding/utils/evaluation.py 中新增 TextGenerateEvaluator 类 用于Generate的评估
6.在gts_engine/qiankunding/utils/tokenization.py中新增 T5的tokenization
7.运行examples/text_generation/run_train_qiankunding.sh 成功如下
8.运行examples/text_generation/run_inference_qiankunding.sh 成功如下
