{"id":13514288,"url":"https://github.com/macournoyer/neuralconvo","last_synced_at":"2025-04-12T18:48:32.228Z","repository":{"id":66366383,"uuid":"44709583","full_name":"macournoyer/neuralconvo","owner":"macournoyer","description":"Neural conversational model in Torch","archived":false,"fork":false,"pushed_at":"2021-05-06T12:45:32.000Z","size":91,"stargazers_count":776,"open_issues_count":26,"forks_count":346,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-04-03T21:12:53.079Z","etag":null,"topics":["deep-learning","machine-learning","neural-conversation-models","seq2seq","torch"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/macournoyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-21T23:08:43.000Z","updated_at":"2025-03-15T09:19:50.000Z","dependencies_parsed_at":"2023-02-20T16:15:43.731Z","dependency_job_id":null,"html_url":"https://github.com/macournoyer/neuralconvo","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/macournoyer%2Fneuralconvo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Fneuralconvo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Fneuralconvo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macournoyer%2Fneuralconvo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macournoyer","download_url":"https://codeload.github.com/macournoyer/neuralconvo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617961,"owners_count":21134197,"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":["deep-learning","machine-learning","neural-conversation-models","seq2seq","torch"],"created_at":"2024-08-01T05:00:51.861Z","updated_at":"2025-04-12T18:48:32.201Z","avatar_url":"https://github.com/macournoyer.png","language":"Lua","funding_links":[],"categories":["Projects","Codes","Lua","Model Zoo"],"sub_categories":["Recurrent Networks"],"readme":"# Neural Conversational Model in Torch\n\nThis is an attempt at implementing [Sequence to Sequence Learning with Neural Networks (seq2seq)](http://arxiv.org/abs/1409.3215) and reproducing the results in [A Neural Conversational Model](http://arxiv.org/abs/1506.05869) (aka the Google chatbot).\n\nThe Google chatbot paper [became famous](http://www.sciencealert.com/google-s-ai-bot-thinks-the-purpose-of-life-is-to-live-forever) after cleverly answering a few philosophical questions, such as:\n\n\u003e **Human:** What is the purpose of living?  \n\u003e **Machine:** To live forever.\n\n## How it works\n\nThe model is based on two [LSTM](https://en.wikipedia.org/wiki/Long_short-term_memory) layers. One for encoding the input sentence into a \"thought vector\", and another for decoding that vector into a response. This model is called Sequence-to-sequence or seq2seq.\n\n![seq2seq](https://4.bp.blogspot.com/-aArS0l1pjHQ/Vjj71pKAaEI/AAAAAAAAAxE/Nvy1FSbD_Vs/s640/2TFstaticgraphic_alt-01.png)  \n_Source: http://googleresearch.blogspot.ca/2015/11/computer-respond-to-this-email.html_\n\nIn this experiment, we train the seq2seq model with movie dialogs from the [Cornell Movie-Dialogs Corpus](http://www.mpi-sws.org/~cristian/Cornell_Movie-Dialogs_Corpus.html). The lines are shortened to the first sentence.\n\n## Sample conversation\n\nHere's a sample conversation after training for 20 epoch with 50000 examples, using the following command:\n\n```sh\nth train.lua --cuda --dataset 50000 --hiddenSize 1000\n```\n\n(Took 3 days to train on my GeForce GTX 780M.)\n\nFor OpenCL, use `--opencl` instead of `--cuda`. To train on CPU, don't provide any of those two.\n\n*WARNING: I can no longer reproduce those results. The cause seems to be a change in one of dependencies. But I'm currently working on a new implementation based on [harvardnlp/seq2seq-attn](https://github.com/harvardnlp/seq2seq-attn).*\n\n\u003e **me:** Hello?  \n\u003e **bot:** Hi.\n\u003e \n\u003e **me:** How are you?  \n\u003e **bot:** I'm fine.\n\u003e \n\u003e **me:** What's your name?  \n\u003e **bot:** It's hard to describe.\n\u003e \n\u003e **me:** How so?  \n\u003e **bot:** I'm not sure.\n\u003e \n\u003e **me:** What color is the sky?  \n\u003e **bot:** It's blue.\n\u003e \n\u003e **me:** What is your job?  \n\u003e **bot:** It's not that i'm a fucking werewolf!\n\u003e \n\u003e **me:** What is the purpose of life?  \n\u003e **bot:** A gift.\n\u003e \n\u003e **me:** Are you intelligent?  \n\u003e **bot:** Yes, well...\n\u003e \n\u003e **me:** Are you a machine?  \n\u003e **bot:** That's a lie.\n\u003e \n\u003e **me:** Are you human?  \n\u003e **bot:** No, i'm not.\n\u003e \n\u003e **me:** What are you?  \n\u003e **bot:** I'm not sure.\n\u003e\n\u003e **me:** Do you plan on taking over the world?  \n\u003e **bot:** No, i don't.\n\nPhew! That was close. Good thing I didn't train it on the full dataset. Please experiment responsibly.\n\n_(Disclaimer: nonsensical responses have been removed.)_\n\n## Installing\n\n1. [Install Torch](http://torch.ch/docs/getting-started.html).\n2. Install the following additional Lua libs:\n\n   ```sh\n   luarocks install nn\n   luarocks install rnn\n   luarocks install penlight\n   ```\n   \n   To train with CUDA install the latest CUDA drivers, toolkit and run:\n\n   ```sh\n   luarocks install cutorch\n   luarocks install cunn\n   ```\n   \n   To train with opencl install the lastest Opencl torch lib:\n\n   ```sh\n   luarocks install cltorch\n   luarocks install clnn\n   ```\n\n3. Download the [Cornell Movie-Dialogs Corpus](http://www.mpi-sws.org/~cristian/Cornell_Movie-Dialogs_Corpus.html) and extract all the files into data/cornell_movie_dialogs.\n\n## Training\n\n```sh\nth train.lua [-h / options]\n```\n\nThe model will be saved to `data/model.t7` after each epoch if it has improved (error decreased).\n\n### Options (some, not all)\n- `--opencl` use opencl for computation (requires [torch-cl](https://github.com/hughperkins/distro-cl))\n- `--cuda` use cuda for computation\n- `--gpu [index]` use the nth GPU for computation (eg. on a 2015 MacBook `--gpu 0` results in the Intel GPU being used while `--gpu 1` uses the far more powerful AMD GPU)\n- `-- dataset [size]` control the size of the dataset\n- `--maxEpoch [amount]` specify the number of epochs to run\n\n## Testing\n\nTo load the model and have a conversation:\n\n```sh\nth eval.lua\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2016 Marc-Andre Cournoyer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacournoyer%2Fneuralconvo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacournoyer%2Fneuralconvo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacournoyer%2Fneuralconvo/lists"}