文件最后提交记录最后更新时间
!4671 【fix】批量修改模型python版本,兼容环境上的python3.8版本 * fix python version 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!5798 Network address of models to be rectified: 20 Merge pull request !5798 from Yss/network_declaration_20 2 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
fix link validity Co-authored-by: frozenleaves<914814442@qq.com> # message auto-generated for no-merge-commit merge: !7517 merge master into master fix link validity Created-by: frozenn Commit-by: frozenleaves Merged-by: ascend-robot Description: ## Motivation Please describe the motivation of this PR and the goal you want to achieve through this PR. ## Modification Please briefly describe what modification is made in this PR. ## Self-test (Optional) If modifications to this PR may cause/fix function/accuracy/performance DTSs/issues, a self-inspection record needs to be attached. ## BC-breaking (Optional) If there are compatibility issues, such as dependencies on cann/torch_npu versions, they need to be explained in the PR. ## Checklist **Before PR**: - [ ] The new code needs to comply with the Clean Code specification. - [ ] The PR content is self-checked, and the expression can be clear and the writing standardized **After PR**: - [ ] CLA has been signed and all committers have signed the CLA in this PR. - [ ] The ci-pipeline is passed, Code Check is passed. See merge request: Ascend/ModelZoo-PyTorch!75171 个月前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
!123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 !123 【深一科技】【高校贡献】【TransformerXL_for_PyTorch】【初次提交】 3 年前
Readme.md

Transformer-xl

This implements training of transformer-xl on the enwik8 dataset, mainly modified from pytorch/examples.

Transformer-xl Detail

As of the current date, Ascend-Pytorch is still inefficient for contiguous operations.Therefore, Transformer-xl is re-implemented using semantics such as custom OP.

Requirements

  • Install PyTorch (pytorch.org)
  • pip install -r requirements.txt

Data Prepration

  • bash getdata.sh

Training and Evaluation

To train a model, run bash test/train_full_8p.sh with the desired model architecture and the path to the enwik8 dataset:

#env
cd transformer-xl
dos2unix ./test/*.sh

# 1p train perf
bash test/train_performance_1p.sh

# 8p train perf
bash test/train_performance_8p.sh

# 8p train full
bash test/train_full_8p.sh

# 1p eval
bash test/eval_1p.sh

  • 参数说明:
#--data               //数据集路径,可自行修改为对应路径的数据集
#--restart_dir        //加载模型checkpoint路径,可自行修改为对应路径的模型文件
#--addr               //主机地址 
#--max_step           //最大训练步数 
#--batch-size         //训练批次大小 
#--lr                 //初始学习率,默认:0.00025
#--device-list        //多卡训练指定训练用卡 ,8卡:'0,1,2,3,4,5,6,7'
#--amp                //是否使用混合精度 
#--loss-scale         //lossscale大小 
#--opt-level          //混合精度类型

Transformer-xl training result

bpc FPS Npu_nums Epochs AMP_Type
- 8300 1 1 O2
1.09 44500 8 50 O2

Statement

For details about the public address of the code in this repository, you can get from the file public_address_statement.md