Git Product home page Git Product logo

txtplz's Introduction

txtplz

Command-line tool for generating texts using neural language models.

Dependencies

  • fairseq
  • Transformers
  • python-regex

On ArchLinux

  • fairseq (not fairseq-git)
  • python-sentencepiece
  • python-transformers
  • python-huggingface-hub

Examples

Just generate some text

$ echo 'A programmer, a horse and a GPU enter a bar' | ./txtplz.py gpt2.xl

A programmer and a horse enter a bar.

A programmer says: "I'm interested in computer science. I have a few friends who do it well." "Do you have money to buy a horse?" "I could buy him, but the horse looks too old for riding."

"Hello, I would like your help to put my ideas into a game. Please reply with a program."
 the programmer just looks at me for few seconds to guess if I am really interested

Generate some names

$ printf '%s\n' {Japanese,Norwegian,Polish,Spanish}$'\t'{death\ metal,hip\ hop,smooth\ jazz} | ./txtplz.py gpt2.xl --input-pattern 'The newly founded {1} {2} band called "' --search '^.*?"[^"]+"' --temperature 1.25 --batch-size 4
The newly founded Japanese death metal band called "Hellhammer."
The newly founded Japanese hip hop band called "Kawade"
The newly founded Japanese smooth jazz band called "Makoto Enshou"
The newly founded Norwegian death metal band called "Lemarchant"
The newly founded Norwegian hip hop band called "We the Robots"
The newly founded Norwegian smooth jazz band called "Norwegian Sky Choir"
The newly founded Polish death metal band called "Death With Black Wings"
The newly founded Polish hip hop band called "Gnocchi and a Kień,"
The newly founded Polish smooth jazz band called "Wunderwudl"
The newly founded Spanish death metal band called "Death From Above"
The newly founded Spanish hip hop band called "Hip Hop Is the Enemy of God and Hip Hop's Opposite"
The newly founded Spanish smooth jazz band called "Los Callejos"

Question answering

$ cat countries.txt
Poland
Argentina
Senegal
Laos
Wielkopolska
Soviet Union
$ ./txtplz.py gpt2.xl --delimiter '[\.\n,\(]' --input-pattern 'Q: What is the capital city of {}? A:'

Q: What is the capital city of Poland? A: Warsaw
Q: What is the capital city of Argentina? A: Buenos Aires
Q: What is the capital city of Senegal? A: Dakar
Q: What is the capital city of Laos? A: Asiatic
Q: What is the capital city of Wielkopolska? A: Wielin Wielka
Q: What is the capital city of Soviet Union? A: Moscow

Find adjectives for names

printf '%s\n' Italy Finland Argentina 'the United States of America' 'USSR' 'Oceania' Laos 'Burkina Faso' \
| ./txtplz.py gpt2.xl --prompt 'Give adjectives for country names\nPoland - Polish\nGreat Britain - British\nSpain - Spanish\n' --input-pattern '{} -' --delimiter '\n' --temperature 0.5

Lemmatize Polish names

$ cat names.txt
Filipa Gralińskiego
Franciszkiem Skąpskim
Marka Smeatona
Adama Małysza
Stanisławem Lemem

$ cat names.txt | ./txtplz.py polish.gpt2.large --prompt 'Podaj formę w mianowniku: Józefa Koronackiego - Józef Koronacki, Anny Budki - Anna Budka, Maciejem Lasoniem - Maciej Lasoń, ' --input-pattern '{} -' --delimiter '[,\.]' --batch-size 4 --remove-input --no-sampling
 Filip Graliński
 Franciszek Skąpanski
 Marek Smetona
 Adam Małysz
 Stanisław Lem

txtplz's People

Contributors

rumburak78 avatar

Stargazers

Anna Fajfer avatar Krzysztof Wilkosz 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.