-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
# tensorlm | ||
|
||
example_wrappers.py charlm | ||
Epoch: 1, Step: 100, Avg. Train Loss: 4.477590560913086 | ||
2017-08-21 23:12:12.203845: I tensorflow/core/common_runtime/gpu/pool_allocator.cc:247] PoolAllocator: After 55341 get requests, put_count=55392 evicted_count=1000 eviction_rate=0.0180531 and unsatisfied allocation rate=0.0182143 | ||
2017-08-21 23:12:12.203869: I tensorflow/core/common_runtime/gpu/pool_allocator.cc:259] Raising pool_size_limit_ from 655 to 720 | ||
Epoch: 1, Step: 200, Avg. Train Loss: 3.0998141765594482 | ||
Epoch: 1, Step: 300, Avg. Train Loss: 2.977341890335083 | ||
Epoch: 1, Step: 400, Avg. Train Loss: 2.8836493492126465 | ||
Epoch: 1, Step: 500, Avg. Train Loss: 2.775566816329956 | ||
The e e e e e e e e e e e e e e e e e ee ee ee ee ee e e e e e e e e e e e e ee ee ee ee ee e e e e e e e | ||
Validation loss: 2.832617928072349 | ||
Generate Shakespeare poems with 4 lines of code. | ||
|
||
## Installation | ||
|
||
pip install tensorflow | ||
pip install tensorlm | ||
|
||
## Usage | ||
|
||
import tensorflow as tf | ||
from tensorlm import WordLM | ||
with tf.Session() as session: | ||
# Create a new model | ||
model = CharLM(session, "datasets/sherlock/train.txt", max_vocab_size=96, | ||
neurons_per_layer=100, num_layers=3, num_timesteps=15) | ||
# Train it | ||
model.train(session, max_epochs=5, max_steps=500, print_logs=True) | ||
|
||
# Let it generate a text | ||
generated = model.sample(session, "The ", num_steps=100) | ||
print("The " + generated) | ||
|
||
This will output: | ||
|
||
Epoch: 1, Step: 100, Avg. Train Loss: 4.477590560913086 | ||
Epoch: 1, Step: 200, Avg. Train Loss: 3.0998141765594482 | ||
Epoch: 1, Step: 300, Avg. Train Loss: 2.977341890335083 | ||
Epoch: 1, Step: 400, Avg. Train Loss: 2.8836493492126465 | ||
Epoch: 1, Step: 500, Avg. Train Loss: 2.775566816329956 | ||
The e e e e e e e e e e e e e e e e e ee ee ee ee ee e e e e e e e e e e e e ee ee ee ee ee e e e e e e e | ||
|
||
## Requirements | ||
|
||
tensorflow >= 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters