• Stars
    star
    239
  • Rank 168,763 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created about 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code for evaluating Japanese pretrained models provided by NTT Ltd.

japanese-dialog-transformers

ๆ—ฅๆœฌ่ชžใฎ่ชฌๆ˜Žๆ–‡ใฏใ“ใกใ‚‰

This repository provides the information necessary to evaluate the Japanese Transformer Encoder-decoder dialogue model provided by NTT on fairseq.


Table of contents.
Update log
Notice for using the codes
Model download
Quick start
LICENSE

Update log

  • Sept. 17, 2021: Published dialogue models (fairseq version japanese-dialog-transformer-1.6B), datasets(JEmpatheticDialogues and JPersonaChat) and evaluation codes.

Notice for using the codes

The dialogue models provided are for evaluation and verification of model performance. Before downloading these models, please read the LICENSE and CAUTION documents. You can download and use these models only if you agree to the following three points.

  1. LICENSE
  2. To be used only for the purpose of evaluation and verification of this model, and not for the purpose of providing dialogue service itself.
  3. Take all possible care and measures to prevent damage caused by the generated text, and take responsibility for the text you generate, whether appropriate or inappropriate.

BibTeX

When publishing results using this model, please cite the following paper.

@misc{sugiyama2021empirical,
      title={Empirical Analysis of Training Strategies of Transformer-based Japanese Chit-chat Systems}, 
      author={Hiroaki Sugiyama and Masahiro Mizukami and Tsunehiro Arimoto and Hiromi Narimatsu and Yuya Chiba and Hideharu Nakajima and Toyomi Meguro},
      year={2021},
      eprint={2109.05217},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Model download


Quick start

The models published on this page can be used for utterance generation and additional fine-tuning using the scripts included in fairseq.

Install dependent libraries

The verification environment is as follows.

  • Python 3.8.10 on miniconda
  • CUDA 11.1/10.2
  • Pytorch 1.8.2 ๏ผˆFor the installation commands, be sure to check the official page. We recommend using pip.)
  • fairseq 1.0.0a0๏ผˆAvailable only from github: validated commit ID was 8adff65ab30dd5f3a3589315bbc1fafad52943e7๏ผ‰
  • sentencepiece 0.1.96

When installing fairseq, please check Requirements and Installation of the official page and install the latest or verified version (8adff65) using github clone. Normal pip install will only install the older version 0.10.2. If you want to run finetune with your own data, you need to install the standalone version of sentencepiece.

fairseq-interactive

Since fairseq-interactive does not have any way to keep the context, it generates responses based on the input sentences only, which is different from the setting that uses the context in Finetune and the paper experiment, so it is easy to generate inappropriate utterances.

In the following command, a small value (10) is used for beam and nbest (number of output candidates) to make the results easier to read. In actual use, it would be better to set the number to 20 or more for better results.

fairseq-interactive data/sample/bin/ \
 --path checkpoints/persona50k-flat_1.6B_33avog1i_4.16.pt\
 --beam 10 \
 --seed 0 \
 --min-len 10 \
 --source-lang src \
 --target-lang dst \
 --tokenizer space \
 --bpe sentencepiece \
 --sentencepiece-model data/dicts/sp_oall_32k.model \
--no-repeat-ngram-size 3 \
--nbest 10 \
--sampling \
--sampling-topp 0.9 \
--temperature 1.0 

dialog.py

The system utilizes a context of about four utterances, which is equivalent to the settings used in the Finetune and paper experiments.

python scripts/dialog.py data/sample/bin/ \
 --path checkpoints/dials5_1e-4_1li20zh5_tw5.143_step85.pt \
 --beam 80 \
 --min-len 10 \
 --source-lang src \
 --target-lang dst \
 --tokenizer space \
 --bpe sentencepiece \
 --sentencepiece-model data/dicts/sp_oall_32k.model \
 --no-repeat-ngram-size 3 \
 --nbest 80 \
 --sampling \
 --sampling-topp 0.9 \
 --temperature 1.0 \
 --show-nbest 5

Perplexity calculation on a specific data set

Computes the perplexity (ppl) on a particular dataset. The lower the ppl, the better the model can represent the interaction on that dataset.

fairseq-validate $DATA_PATH \
 --path $MODEL_PATH \
 --task translation \
 --source-lang src \
 --target-lang dst \
 --batch-size 2 \ 
 --ddp-backend no_c10d \
 --valid-subset test \ 
 --skip-invalid-size-inputs-valid-test 

Finetuning with Persona-chat and EmpatheticDialogues

By finetuning the Pretrained model with PersonaChat or EmpatheticDialogues, you can create a model that is almost identical to the finetuned model provided.

If you have your own dialogue data, you can place the data in the same format in data/*/raw and perform Finetune on that data. Please note, however, that we do not allow the release or distribution of Finetune models under the LICENSE. You can release your own data and let a third party run Finetune from this model.

Downloading and converting datasets

Convert data from Excel to a simple input statement (src) and output statement (dst) format, where the same row in src and dst is the corresponding input/output pair. 50000 rows are split and output as a train.

python scripts/extract_ed.py japanese_empathetic_dialogues.xlsx data/empdial/raw/

License

LICENSE

More Repositories

1

byol-a

BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation
Python
202
star
2

msm-mae

Masked Spectrogram Modeling using Masked Autoencoders for Learning General-purpose Audio Representations
Jupyter Notebook
86
star
3

m2d

Masked Modeling Duo: Towards a Universal Audio Pre-training Framework
Jupyter Notebook
58
star
4

dcase2023_task2_baseline_ae

Python
50
star
5

eval-audio-repr

EVAR ~ Evaluation package for Audio Representations
Python
40
star
6

composing-general-audio-repr

Composing General Audio Representation by Fusing Multilayer Features of a Pre-trained Model
Jupyter Notebook
26
star
7

edge-consensus-learning

P2P Distributed deep learning framework that runs on PyTorch.
Python
22
star
8

ToyADMOS2-dataset

ToyADMOS2: Another dataset of miniature-machine operating sounds for anomalous sound detection under domain shift conditions ๐Ÿš— ๐Ÿšƒ
Python
14
star
9

Generalized-Domain-Adaptation

Python
12
star
10

dcase2023_task2_evaluator

Python
10
star
11

rg-cache

Code for the paper "Reflectance-guided, contrast-accumulated histogram equalization" published in ICASSP 2020.
MATLAB
9
star
12

baxter-permutation-process

Bayesian nonparametric relational data analysis based on Baxter permutation process
Python
7
star
13

Learning-with-Selective-Forgetting

This is an official PyTorch impelementation of our paper "Learning with Selective Forgetting" (IJCAI21).
Python
6
star
14

rope

Code of the paper "Reflectance-oriented probabilistic equalization for image enhancement" published in ICASSP 2021.
MATLAB
5
star
15

japanese-long-term-chat

5
star
16

permuton-induced-crp

Bayesian inference for Permuton-induced Chinese Restaurant Process (NeurIPS2021).
MATLAB
4
star
17

AccLearningONN

Acceleration method for learning fine-layered optical neural networks
Python
4
star
18

dcase2024_task2_evaluator

Python
4
star
19

ecl-isvr

P2P Distributed deep learning framework that runs on PyTorch.
Python
3
star
20

floor-padding-BO

Python
3
star
21

cone

Official PyTorch Implementation of "Deep Quantigraphic Image Enhancement via Comparametric Equations" (ICASSP2023)
Python
3
star
22

DET_AFP

This is the official PyTorch impelementation of our paper "Robustizing Object Detection Networks Using Augmented Feature Pooling" (ACCV2022, Oral).
Python
3
star
23

audio-diff-caps

Python
2
star
24

apwd-dataset

2
star
25

deep-sound-field-denoiser

Python
2
star
26

diff-eq-comput-zdd

An implementation of "Differentiable Equilibrium Computation with Decision Diagrams for Stackelberg Models of Combinatorial Congestion Games" in NeurIPS 2021.
C++
2
star
27

adaptive-leveling-BO

Python
1
star
28

fast-ecp-ecn

An implementation of "A Fast and Exact Evaluation Algorithm for the Expected Number of Connected Nodes: an Enhanced Network Reliability Measure" in IEEE INFOCOM 2023.
C++
1
star
29

cs-reliability

An implementation of "Efficient Network Reliability Evaluation for Client-Server Model" in IEEE GLOBECOM 2021.
C++
1
star
30

time-considerable-dialogue-model

This repository provides the information necessary to evaluate time-considerable dialogue models.
1
star