Giter Club home page Giter Club logo

text-generation-pytorch's Introduction

text-generation

1. Introduction

In this repo, i implement simple text generation using different decoding methods with Transformers.

2. Install

$ pip3 install -r requiresment.txt

3. Usage

$ git clone https://github.com/HiepThanh0510/text-generation && cd text-generation
  • Greedy Search (Beam Search with num_beam = 1)

    $ python3 text_generation.py --generate_type greedy_search --max_new_tokens 20 --prompt "Quần đảo Hoàng Sa, Trường Sa là của" --no_repeat_ngram_size 3
    
    >  Việt Nam, nhưng Trung Quốc đã ngang ngược tuyên bố chủ quyền trên toàn bộ quần đảo này.
  • Beam Search:

    $ python3 text_generation.py --generate_type beam_search --max_new_tokens 42 --prompt "Việt Nam là quốc gia" --no_repeat_ngram_size 3 --num_beam 4
    
    >  đứng thứ 2 trên thế giới về sản xuất  xuất khẩu  phê. Năm 2017, Việt Nam xuất khẩu khoảng 1,6 triệu tấn  phê, tăng 13,4% so với năm 2016.

text-generation-pytorch's People

Contributors

hiepthanh0510 avatar

Stargazers

Kaby Lake avatar Thanh Vo avatar  avatar

Watchers

 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.