{"id":15621811,"url":"https://github.com/hunkim/word-rnn-tensorflow","last_synced_at":"2025-05-16T03:05:50.906Z","repository":{"id":98203242,"uuid":"57287024","full_name":"hunkim/word-rnn-tensorflow","owner":"hunkim","description":"Multi-layer Recurrent Neural Networks (LSTM, RNN) for word-level language models in Python using TensorFlow.","archived":false,"fork":false,"pushed_at":"2019-10-09T18:46:51.000Z","size":564,"stargazers_count":1301,"open_issues_count":33,"forks_count":491,"subscribers_count":82,"default_branch":"master","last_synced_at":"2025-04-08T13:12:51.080Z","etag":null,"topics":["lstm","python","rnn","rnn-tensorflow","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunkim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-28T09:11:29.000Z","updated_at":"2025-03-21T16:05:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"290e1ec3-dee2-4930-ae58-115bbf4bdd3e","html_url":"https://github.com/hunkim/word-rnn-tensorflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fword-rnn-tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fword-rnn-tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fword-rnn-tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunkim%2Fword-rnn-tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunkim","download_url":"https://codeload.github.com/hunkim/word-rnn-tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lstm","python","rnn","rnn-tensorflow","tensorflow"],"created_at":"2024-10-03T09:51:57.055Z","updated_at":"2025-05-16T03:05:45.895Z","avatar_url":"https://github.com/hunkim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# word-rnn-tensorflow\n[![Build Status](https://travis-ci.org/hunkim/word-rnn-tensorflow.svg?branch=master)](https://travis-ci.org/hunkim/word-rnn-tensorflow)\n\nMulti-layer Recurrent Neural Networks (LSTM, RNN) for word-level language models in Python using TensorFlow.\n\nMostly reused code from https://github.com/sherjilozair/char-rnn-tensorflow which was inspired from Andrej Karpathy's [char-rnn](https://github.com/karpathy/char-rnn).\n\n# Requirements\n- [Tensorflow 1.1.0rc0](http://www.tensorflow.org)\n\n# Basic Usage\nTo train with default parameters on the tinyshakespeare corpus, run:\n```bash\npython train.py\n```\n\nTo sample from a trained model\n```bash\npython sample.py\n```\n\nTo pick using beam search, use the `--pick` parameter. Beam search can be\nfurther customized using the `--width` parameter, which sets the number of beams\nto search with. For example:\n```bash\npython sample.py --pick 2 --width 4\n```\n\n# Sample output\n\n### Word-RNN\n```\nLEONTES:\nWhy, my Irish time?\nAnd argue in the lord; the man mad, must be deserved a spirit as drown the warlike Pray him, how seven in.\n\nKING would be made that, methoughts I may married a Lord dishonour\nThan thou that be mine kites and sinew for his honour\nIn reason prettily the sudden night upon all shalt bid him thus again. times than one from mine unaccustom'd sir.\n\nLARTIUS:\nO,'tis aediles, fight!\nFarewell, it himself have saw.\n\nSLY:\nNow gods have their VINCENTIO:\nWhipt fearing but first I know you you, hinder truths.\n\nANGELO:\nThis are entitle up my dearest state but deliver'd.\n\nDUKE look dissolved: seemeth brands\nThat He being and\nfull of toad, they knew me to joy.\n```\n\n### Char-RNN\n```\nESCALUS:\nWhat is our honours, such a Richard story\nWhich you mark with bloody been Thilld we'll adverses:\nThat thou, Aurtructs a greques' great\nJmander may to save it not shif theseen my news\nClisters it take us?\nSay the dulterout apy showd. They hance!\n\nAnBESS OF GUCESTER:\nNow, glarding far it prick me with this queen.\nAnd if thou met were with revil, sir?\n\nKATHW:\nI must not my naturation disery,\nAnd six nor's mighty wind, I fairs, if?\n\nMessenger:\nMy lank, nobles arms;\n```\n\n## Beam search\n\nBeam search differs from the other `--pick` options in that it does not greedily\npick single words; rather, it expands the most promising nodes and keeps a\nrunning score for each beam.\n\n### Word-RNN (with beam search)\n```\n# python sample.py --prime \"KING RICHARD III:\" -n 100 --pick 2 --width 4\n\nKING RICHARD III:\nyou, and and and and have been to be hanged, I am not to be touched?\n\nProvost:\nA Bohemian born, for tying his own train,\nForthwith by all that converses more with a crow-keeper;\nI have drunk, Broach'd with the acorn cradled. Follow.\n\nFERDINAND:\nWho would not be conducted.\n\nBISHOP OF ELY:\nIf you have been a-bed an acre of barren ground, hath holy;\nI warrant, my lord restored of noon.\n\nISABELLA:\n'Save my master and his shortness whisper me to the pedlar;\nMoney's a medler.\nThat I will pamper it to complain.\n\nVOLUMNIA:\nIndeed, I am\n```\n\n### Word-RNN (without beam search)\n```\n# python sample.py --prime \"KING RICHARD III:\" -n 100\n\nKING RICHARD III:\nmarry, so and unto the wind have yours;\nAnd thou Juliet, sir?\n\nJULIET:\nWell, wherefore speak your disposition cousin;\nMay thee flatter.\nMy hand will answer him;\ne not to your Mariana Below these those and take this life,\nThat stir not light of reason.\nThe time Lucentio keeps a root from you.\nCursed be his potency,\nIt was my neighbour till the birth and I drank stay.\n\nMENENIUS:\nHere's the matter,\nI know take this sour place,\nthey know allegiance Had made you guilty.\nYou do her bear comfort him between him or our noble bosom he did Bolingbroke's\n```\n\n# Projects\nIf you have any project using this word-rnn, please let us know. I'll list up your project here.\n\n- http://bot.wpoem.com/ (Simple poem generator in Korean)\n\n\n# Contribution\nYour comments (issues) and PRs are always welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunkim%2Fword-rnn-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunkim%2Fword-rnn-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunkim%2Fword-rnn-tensorflow/lists"}