# transformer **Repository Path**: ganhan/transformer ## Basic Information - **Project Name**: transformer - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-25 - **Last Updated**: 2021-11-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # **基于Transformer模型的机器翻译** ## 题目描述 实现Transformer模型,使用预处理好的IWSLT’14 De-En数据集[3]进行训练,输入德文输出对应的英文。 ## 所需环境 * Anaconda3(建议使用) * python3.6/3.7/3.8 * pycharm (IDE) * pytorch 1.7.1 (pip package) * torchvision 0.8.1 (pip package) * tensorflow 2.4.1 (pip package) #### 安装教程 1. 将代码克隆到本地 2. 代码所用模型太大无法上传,可在此链接下载 链接:https://pan.baidu.com/s/1clZMWZuluNEzfmNPlzg7YA 提取码:klv7 3. 运行train.py文件 python train.py #### 文件格式 |-- ROOT |-- config.py |-- demo.py |-- LICENSE |-- model.py |-- README.en.md |-- directoryList.md |-- README.md |-- tokenizer.py |-- train.py |-- Transformer.py |-- validloss.py |-- data | |-- bpevocab | |-- code | |-- test.de | |-- test.en | |-- test.txt | |-- train.de | |-- train.en | |-- train.txt | |-- valid.de | |-- valid.en |-- json |-- config.json |-- word_index.json 如directoryList.md所示 #### 参与贡献 1. 重建字典格式 2. 实现贪心算法匹配 3. 实现模型的改错和优化 #### 实验结果图 ![image-20211126171804482](README.assets/image-20211126171804482.png) ![image-20211126171808518](README.assets/image-20211126171808518.png) #### 实验结果 ![image-20211130214650494](README.assets/image-20211130214650494.png)