← Open Source
codekansas

keras-language-modeling

:book: Some language modeling tools for Keras.

TutorialsML/AI fundamentalsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
658
Stars
162
Forks
+0
This week
3
Contributors
Created 2016-04-19 · Updated 2026-09-04 · #15383 today
Top developers
codekansaseshijianigeljyng

codekansas/keras-language-modeling is ranked 15,383 with 658 stars.

Same-category comparison

codekansas/keras-language-modeling is ranked 15,383 among these 8 peers; WillKoehrsen/Machine-Learning-Projects is ranked 15,393.

Same-category comparison
NameRankMetrics
zaidalyafeai/ml-projects15,324
Language:
JavaScript
Stars:
663
Forks:
252
dotnet/eShopSupport15,328
Language:
JavaScript
Stars:
662
Forks:
192
Description:
A reference . NET application using AI for a customer support ticketing system.
openai/openai-chatkit-advanced-samples15,331
Stars:
662
Forks:
310
Description:
Starter app to build with OpenAI ChatKit SDK.
DA-southampton/Read_Bert_Code15,353
Language:
Python
Stars:
660
Forks:
151
WillKoehrsen/Machine-Learning-Projects15,393
Language:
Jupyter Notebook
Stars:
657
Forks:
487
Description:
Machine Learning Experiments and Work.
achuthasubhash/Complete-Life-Cycle-of-a-Data-Science-Project15,395
Stars:
657
Forks:
256
Description:
Complete-Life-Cycle-of-a-Data-Science-Project.
bojone/bert_in_keras15,399
Language:
Python
Stars:
657
Forks:
231
martimfasantos/ai-agents-frameworks15,403
Language:
Python
Stars:
657
Forks:
65
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryTutorials
SubcategoryML/AI fundamentals
Stars658
Forks162
Contributors3
Created date2016-04-19
Updated date2026-09-04
Stars in 1 day0
Stars in 7 days0
Rank15,383
Previous rank15,197
Rank change-186
7-day stars rank14,970
Previous 7-day stars rank14,974
7-day stars rank change4
Total stars rank15,600
Previous total stars rank15,573
Total stars rank change-27
CountryUSA
README summary

keras-language-modeling Some code for doing language modeling with Keras, in particular for question-answering tasks. I wrote a very long blog post that explains how a lot of this works, which can be found here. Stuff that might be of interest : Attentional LSTM, based on one of the papers referenced in the blog post and others. One application used it for image captioning. It is initialized with an attention vector which provides the attention component for the neural

network. : Evaluation framework for the InsuranceQA dataset. To get this working, clone the data repository and set the environment variable to the cloned repository. Changing will adjust how the model is trained. : The class uses the settings to generate a training model and a testing model. The model can be trained by passing a question vector, a ground truth answer vector, and a bad answer vector to . Then calculates the similarity between a question and answer. Override the method with

whatever language model you want to get a trainable model. Examples are provided at the bottom, including the , , and . py models/ models/ ` This is useful in combination with ngrok for monitoring training progress away from your desktop. Additionally The official implementation can be found here Data L6 from Yahoo Webscope InsuranceQA data Pythonic version

Frequently asked questions

How many stars and forks are recorded?

codekansas/keras-language-modeling has 658 stars and 162 forks.

What is the repository rank?

codekansas/keras-language-modeling is ranked 15,383.

What language and category are recorded?

codekansas/keras-language-modeling has 658 stars, uses Python and belongs to Tutorials.

Which repository is closest in rank?

codekansas/keras-language-modeling is compared with WillKoehrsen/Machine-Learning-Projects, ranked 15,393 with 657 stars.

README

keras-language-modeling

Some code for doing language modeling with Keras, in particular for question-answering tasks. I wrote a very long blog post that explains how a lot of this works, which can be found here.

Stuff that might be of interest

  • attention_lstm.py: Attentional LSTM, based on one of the papers referenced in the blog post and others. One application used it for image captioning. It is initialized with an attention vector which provides the attention component for the neural network.
  • insurance_qa_eval.py: Evaluation framework for the InsuranceQA dataset. To get this working, clone the data repository and set the INSURANCE_QA environment variable to the cloned repository. Changing config will adjust how the model is trained.
  • keras-language-model.py: The LanguageModel class uses the config settings to generate a training model and a testing model. The model can be trained by passing a question vector, a ground truth answer vector, and a bad answer vector to fit. Then predict calculates the similarity between a question and answer. Override the build method with whatever language model you want to get a trainable model. Examples are provided at the bottom, including the EmbeddingModel, ConvolutionModel, and RecurrentModel.

Getting Started

# Install Keras (may also need dependencies)
git clone https://github.com/fchollet/keras
cd keras
sudo python setup.py install

# Clone InsuranceQA dataset
git clone https://github.com/codekansas/insurance_qa_python
export INSURANCE_QA=$(pwd)/insurance_qa_python

# Run insurance_qa_eval.py
git clone https://github.com/codekansas/keras-language-modeling
cd keras-language-modeling/
python insurance_qa_eval.py

Alternatively, I wrote a script to get started on a Google Cloud Platform instance (Ubuntu 16.04) which can be run via

cd ~
git clone https://github.com/codekansas/keras-language-modeling
cd keras-language-modeling
source install.py

I've been working on making these models available out-of-the-box. You need to install the Git branch of Keras (and maybe make some modifications) in order to run some of these models; the Keras project can be found here.

The runnable program is insurance_qa_eval.py. This will create a models/ directory which will store a history of the model's weights as it is created. You need to set an environment variable to tell it where the INSURANCE_QA dataset is.

Finally, my setup (which I think is pretty common) is to have an SSD with my operating system, and an HDD with larger data files. So I would recommend creating a models/ symlink from the project directory to somewhere in your HDD, if you have a similar setup.

Serving to a port

I added a command line argument that uses Flask to serve to a port. Once you've installed Flask, you can run:

python insurance_qa_eval.py serve

This is useful in combination with ngrok for monitoring training progress away from your desktop.

Additionally

  • The official implementation can be found here

Data

Nearby in the ranking
Similar items