• Stars
    star
    1,305
  • Rank 36,065 (Top 0.8 %)
  • Language
    Python
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 5 years ago

Reviews

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

Repository Details

Multi-layer Recurrent Neural Networks (LSTM, RNN) for word-level language models in Python using TensorFlow.

word-rnn-tensorflow

Build Status

Multi-layer Recurrent Neural Networks (LSTM, RNN) for word-level language models in Python using TensorFlow.

Mostly reused code from https://github.com/sherjilozair/char-rnn-tensorflow which was inspired from Andrej Karpathy's char-rnn.

Requirements

Basic Usage

To train with default parameters on the tinyshakespeare corpus, run:

python train.py

To sample from a trained model

python sample.py

To pick using beam search, use the --pick parameter. Beam search can be further customized using the --width parameter, which sets the number of beams to search with. For example:

python sample.py --pick 2 --width 4

Sample output

Word-RNN

LEONTES:
Why, my Irish time?
And argue in the lord; the man mad, must be deserved a spirit as drown the warlike Pray him, how seven in.

KING would be made that, methoughts I may married a Lord dishonour
Than thou that be mine kites and sinew for his honour
In reason prettily the sudden night upon all shalt bid him thus again. times than one from mine unaccustom'd sir.

LARTIUS:
O,'tis aediles, fight!
Farewell, it himself have saw.

SLY:
Now gods have their VINCENTIO:
Whipt fearing but first I know you you, hinder truths.

ANGELO:
This are entitle up my dearest state but deliver'd.

DUKE look dissolved: seemeth brands
That He being and
full of toad, they knew me to joy.

Char-RNN

ESCALUS:
What is our honours, such a Richard story
Which you mark with bloody been Thilld we'll adverses:
That thou, Aurtructs a greques' great
Jmander may to save it not shif theseen my news
Clisters it take us?
Say the dulterout apy showd. They hance!

AnBESS OF GUCESTER:
Now, glarding far it prick me with this queen.
And if thou met were with revil, sir?

KATHW:
I must not my naturation disery,
And six nor's mighty wind, I fairs, if?

Messenger:
My lank, nobles arms;

Beam search

Beam search differs from the other --pick options in that it does not greedily pick single words; rather, it expands the most promising nodes and keeps a running score for each beam.

Word-RNN (with beam search)

# python sample.py --prime "KING RICHARD III:" -n 100 --pick 2 --width 4

KING RICHARD III:
you, and and and and have been to be hanged, I am not to be touched?

Provost:
A Bohemian born, for tying his own train,
Forthwith by all that converses more with a crow-keeper;
I have drunk, Broach'd with the acorn cradled. Follow.

FERDINAND:
Who would not be conducted.

BISHOP OF ELY:
If you have been a-bed an acre of barren ground, hath holy;
I warrant, my lord restored of noon.

ISABELLA:
'Save my master and his shortness whisper me to the pedlar;
Money's a medler.
That I will pamper it to complain.

VOLUMNIA:
Indeed, I am

Word-RNN (without beam search)

# python sample.py --prime "KING RICHARD III:" -n 100

KING RICHARD III:
marry, so and unto the wind have yours;
And thou Juliet, sir?

JULIET:
Well, wherefore speak your disposition cousin;
May thee flatter.
My hand will answer him;
e not to your Mariana Below these those and take this life,
That stir not light of reason.
The time Lucentio keeps a root from you.
Cursed be his potency,
It was my neighbour till the birth and I drank stay.

MENENIUS:
Here's the matter,
I know take this sour place,
they know allegiance Had made you guilty.
You do her bear comfort him between him or our noble bosom he did Bolingbroke's

Projects

If you have any project using this word-rnn, please let us know. I'll list up your project here.

Contribution

Your comments (issues) and PRs are always welcome.

More Repositories

1

DeepLearningZeroToAll

TensorFlow Basic Tutorial Labs
Jupyter Notebook
4,470
star
2

PyTorchZeroToAll

Simple PyTorch Tutorials Zero to ALL!
Python
3,759
star
3

deep_architecture_genealogy

Deep Learning Architecture Genealogy Project
Python
1,219
star
4

DeepLearningStars

Top Deep Learning Projects based on their Stars!
Python
384
star
5

effective_python_notebook

Jupyter Notebook
263
star
6

ReinforcementZeroToAll

Python
242
star
7

es-gpt

Python
206
star
8

KaggleZeroToAll

Kaggle problem solving
Jupyter Notebook
168
star
9

Wit-Facebook

Wit-Faebook Messenger Example
JavaScript
158
star
10

ml

Course Web page
HTML
141
star
11

kakao-gpt

124
star
12

GoogleCloudMLExamples

Python
71
star
13

line-gpt

40
star
14

book_writer

Python
38
star
15

smile_more

Check your face and make sure you smile using Google Vision API.
Python
37
star
16

PythonZeroToAll

Jupyter Notebook
30
star
17

digital-human

JavaScript
27
star
18

llama-up-data

26
star
19

FacebookSpamOut

Facebook (group) spam out
PHP
24
star
20

line-papago-bot

Simple Line/Kakao-Papago Translation Bot.
Python
24
star
21

gpt3-krtranslated-qa

20
star
22

gpt-py-review

Python
19
star
23

nsmlZeroToAll

Python
18
star
24

gpt3-python-doc-qa

16
star
25

chatgpt-askup-search-plugin

AskUp Search ChatGPT Plugin
Python
16
star
26

llm_gpu_cal

🔮 LLM GPU Calculator
Python
14
star
27

clova-up

Python
10
star
28

deep-facebook-commenter

9
star
29

DialogflowZeroToAll

Dialogflow Simple Tutorials
8
star
30

comp1021

comp1021 repository
6
star
31

assembly

Open assembly information
HTML
6
star
32

translation_coverage

Automatically check the rates between alpha VS other (unicode)
Python
6
star
33

FacebookGroupMemberPics

PHP
6
star
34

sagemaker-aihub

Jupyter Notebook
5
star
35

FacebookProfileOverlay

HTML
5
star
36

bible-friend

Kakai/Line bot for quick bible search
Python
5
star
37

PythonWithTurtle

Basic python programming with turtle graphics
5
star
38

askup_info

Python
4
star
39

gpt-plugin-bible-talk

Python
4
star
40

alexa-ask-facebook

Python
3
star
41

slack_diffusion

Python
3
star
42

mediapipe-facedetection

Python
2
star
43

codemirror-materialui-sveltekit

Svelte
1
star
44

faq_search

Python
1
star
45

askup-info

1
star
46

ask

1
star
47

info_masker

1
star
48

toy_fc

Python
1
star
49

solar-paralegal

LLMxLaw Hackathon
Python
1
star