From a6fc10818f6aa1ed60a8d4e0680983deaed9cad1 Mon Sep 17 00:00:00 2001 From: Michael Tu Date: Wed, 19 Jul 2017 18:52:26 -0400 Subject: [PATCH] Fix SM Model Internal Reproducibility Bug (#34) * Fix SM Model reproducibility bug vocab is in different order every time, causing unseen words to use different random states * Make requirements.txt usable from conda and pip The existing torch requirement does not work with conda or pip. Also upgrade pytorch version while we are at it. --- sm_cnn/requirements.txt | 2 +- sm_cnn/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sm_cnn/requirements.txt b/sm_cnn/requirements.txt index 8e4d407..20759b0 100644 --- a/sm_cnn/requirements.txt +++ b/sm_cnn/requirements.txt @@ -2,4 +2,4 @@ gensim==1.0.1 nltk==3.2.1 numpy==1.11.3 pandas==0.19.2 -torch==0.1.11+b13b701 +pytorch==0.1.12 diff --git a/sm_cnn/utils.py b/sm_cnn/utils.py index 8c3e9db..779c55b 100644 --- a/sm_cnn/utils.py +++ b/sm_cnn/utils.py @@ -155,7 +155,7 @@ def read_in_dataset(dataset_folder, set_folder, stop_punct=False, dash_split=Fal for sentence in all_data: for term in sentence.split(): vocab_set.add(term) - vocab = list(vocab_set) + vocab = sorted(list(vocab_set)) return [questions, sentences, labels, max(len_q_list), max(len_s_list), vocab]