Giter VIP home page Giter VIP logo

korbertsum's Introduction

BertSum

This code is from paper Fine-tune BERT for Extractive Summarization(https://arxiv.org/pdf/1903.10318.pdf)

!New: Please see our full paper with trained models

Package Requirements: pytorch pytorch_pretrained_bert tensorboardX multiprocess pyrouge

Some codes are borrowed from ONMT(https://github.com/OpenNMT/OpenNMT-py)

한국어 문서 추출요약을 위한 Modified BertSum

해당 문서의 원저작권은 Nlpyang의 BertSum 에 있습니다.

저의 벨로그 에 코드와 플로우 설명이 있습니다.

Step 1. Prepare Data

To run etri-api-scraper.py

python etri_api_scraper.py --input '.../train.jsonl' --api_key 'openapi key' --first_index 0 --last_index 5000

From newsdata to json

python article_to_json.py -mode train -news_dir '' -output ''

From json to Bert pytorch file

python preprocess.py -mode format_to_bert -raw_path ../json_data -save_path ../bert_data -vocab_file_path 'etri vocab file list'

Step 2. Train

To train with endoer-classifier

python train.py -mode train -encoder classifier -dropout 0.1 -bert_data_path ../bert_data/korean -model_path ../models/bert_classifier -lr 2e-3 -visible_gpus 0 -gpu_ranks 0 -world_size 1 -report_every 50 -save_checkpoint_steps 1000 -batch_size 1000 -decay_method noam -train_steps 1000 -accum_count 1 -log_file ../logs/bert_classifier -use_interval true -warmup_steps 8000 -bert_model ../001_bert_morp_pytorch -bert_config_path ../001_bert_morp_pytorch/bert_config.json -temp_dir ../temp

Step 3. Validate

위의 코드에서 -mode validate로 수정하면 됩니다.

Step 4. Test

위의 코드에서 -mode test -test_from bert_model_path 로 수정하면 됩니다.

실행 예시 파일 Newsdata_extractive_summ.ipynb 에 실행 예시가 있습니다.

CHATBOT

Newsdata_summarybot.ipynb 에 실행 예시가 있습니다. example

korbertsum's People

Contributors

nlpyang avatar raqoon886 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.