Giter Site home page Giter Site logo

metterian / transformer-evolution Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paul-hyun/transformer-evolution

1.0 0.0 0.0 6.2 MB

Transformer 이후 나온 Pretrained Language Model을 간단하게 구현한 프로젝트

License: Apache License 2.0

Python 17.54% Jupyter Notebook 82.46%

transformer-evolution's Introduction

transformer-evolution

Transformer 이후 나온 Pretrained Language Model을 이해하기 위해서 간단하게 구현 하였습니다.

환경

  • Python(=3.6)
$ pip install torch
$ pip install pandas
$ pip install tqdm
$ pip install wget
$ pip install sentencepiece
$ pip install wandb

train data 준비

$ python common_data.py --mode download
  • data 폴더 아래 'ratings_test.txt', 'ratings_train.txt' 두개의 파일을 다운로드 합니다.

pretrain data 준비

$ git clone https://github.com/paul-hyun/web-crawler.git
$ cd web-crawler
$ python kowiki.py
  • 다운로드 된 kowiki_yyyymmdd.csv 파일을 /data/kowiki.csv로 복사해 주세요.

vocab 생성

  • kowiki 데이터를 sentencepiece를 이용해서 생성 합니다.
  • vocab size는 8,000개 입니다.
$ python vocab.py
  • 'kowiki.model', 'kowiki.vocab' vocab 관련한 두개의 파일을 생성 합니다.

data 생성

  • pretrain 및 train data를 모델에서 사용하기 좋은 형태로 미리 만들어 놓습니다.
  • 세부 처리는 각 모델에서 필요에 따라 처리 합니다.
$ python common_data.py --mode prepare
  • data 폴더 아래 'kowiki.json' 파일이 생성 됩니다.

기타

  • 사용하는 GPU 자원의 한계로 config 설정은 hidden 및 관련 parameter 1/2로 줄여서 테스트 했습니다. (config_half.json)
  • GPU 자원이 충분한 경우 config.json을 사용하면 됩니다.

모델

결과

ITEM Pretrain epoch loss accuracy
transformer-pre:0 0 19 0.3054 0.8312
gpt-pre:60-lm:0 60 19 0.3015 0.8442
bert-pre:40 40 19 0.3507 0.8175

loss

accuracy

자세한 내용은 아래를 참고 하세요.

참고

transformer-evolution's People

Contributors

paul-hyun avatar

Stargazers

SeungJun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.