Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: emoji2vec
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- _tflow_select=2.3.0=mkl
- absl-py=0.15.0=pyhd3eb1b0_0
- astor=0.8.1=py36h06a4308_0
- blas=1.0=mkl
- c-ares=1.18.1=h7f8727e_0
- ca-certificates=2022.07.19=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- coverage=5.5=py36h27cfd23_2
- cython=0.29.24=py36h295c915_0
- dataclasses=0.8=pyh4f3eec9_6
- gast=0.5.3=pyhd3eb1b0_0
- google-pasta=0.2.0=pyhd3eb1b0_0
- grpcio=1.36.1=py36h2157cd5_1
- h5py=2.10.0=py36hd6299e0_1
- hdf5=1.10.6=hb1b8bf9_0
- importlib-metadata=4.8.1=py36h06a4308_0
- intel-openmp=2022.0.1=h06a4308_3633
- joblib=1.0.1=pyhd3eb1b0_0
- keras-applications=1.0.8=py_1
- keras-preprocessing=1.1.2=pyhd3eb1b0_0
- ld_impl_linux-64=2.38=h1181459_1
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgfortran-ng=7.5.0=ha8ba4b0_17
- libgfortran4=7.5.0=ha8ba4b0_17
- libgomp=11.2.0=h1234567_1
- libprotobuf=3.17.2=h4ff587b_1
- libstdcxx-ng=11.2.0=h1234567_1
- markdown=3.3.4=py36h06a4308_0
- mkl=2018.0.3=1
- mkl_fft=1.0.6=py36h7dd41cf_0
- mkl_random=1.0.1=py36h4414c95_1
- ncurses=6.3=h5eee18b_3
- numpy=1.15.4=py36h1d66e8a_0
- numpy-base=1.15.4=py36h81de0dd_0
- openssl=1.1.1q=h7f8727e_0
- pandas=1.1.5=py36h2531618_0
- pip=21.2.2=py36h06a4308_0
- protobuf=3.17.2=py36h295c915_0
- python=3.6.13=h12debd9_1
- python-dateutil=2.8.2=pyhd3eb1b0_0
- pytz=2021.3=pyhd3eb1b0_0
- readline=8.1.2=h7f8727e_1
- scikit-learn=0.23.2=py36h0573a6f_0
- scipy=0.19.1=py36h9976243_3
- setuptools=58.0.4=py36h06a4308_0
- six=1.16.0=pyhd3eb1b0_1
- sqlite=3.39.2=h5082296_0
- tbb=2021.5.0=hd09550d_0
- tbb4py=2021.3.0=py36hd09550d_0
- tensorboard=1.14.0=py36hf484d3e_0
- tensorflow=1.14.0=mkl_py36h2526735_0
- tensorflow-base=1.14.0=mkl_py36h7ce6ba3_0
- tensorflow-estimator=1.14.0=py_0
- termcolor=1.1.0=py36h06a4308_1
- threadpoolctl=2.2.0=pyh0d69192_0
- tk=8.6.12=h1ccaba5_0
- typing_extensions=4.1.1=pyh06a4308_0
- werkzeug=2.0.3=pyhd3eb1b0_0
- wheel=0.37.1=pyhd3eb1b0_0
- wrapt=1.12.1=py36h7b6447c_1
- xz=5.2.5=h7f8727e_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.12=h7f8727e_2
- pip:
- gensim==0.13.4.1
- smart-open==6.0.0
prefix: /home/lhk/anaconda3/envs/emoji2vec
4 changes: 2 additions & 2 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ def __init__(self, model_params, num_emoji, embeddings_array, use_embeddings=Tru
v_col = tf.nn.dropout(v_col, (1 - model_params.dropout))

# Calculate the predicted score, a.k.a. dot product (here)
self.score = tf.reduce_sum(tf.mul(v_row, v_col), 1)
self.score = tf.reduce_sum(tf.multiply(v_row, v_col), 1)

# Probability of match
self.prob = tf.sigmoid(self.score)

# Calculate the cross-entropy loss
self.loss = tf.nn.sigmoid_cross_entropy_with_logits(self.score, self.y)
self.loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=self.score, labels=self.y)

# train the model using the appropriate parameters
def train(self, kb, hooks, session):
Expand Down
2 changes: 1 addition & 1 deletion naga/shared/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __call__(self, batcher, placeholders, loss, model=None, session=None):
session = tf.Session()
close_session_after_training = True # no session existed before, we provide a temporary session

init = tf.initialize_all_variables()
init = tf.global_variables_initializer()
session.run(init)
epoch = 1
iteration = 1
Expand Down
4 changes: 2 additions & 2 deletions tfrnn/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def __call__(self, sess, epoch, iteration, model, loss):
raise NotImplementedError

def update_summary(self, sess, current_step, title, value):
cur_summary = tf.scalar_summary(title, value)
merged_summary_op = tf.merge_summary([cur_summary]) # if you are using some summaries, merge them
cur_summary = tf.summary.scalar(title, value)
merged_summary_op = tf.summary.merge([cur_summary]) # if you are using some summaries, merge them
summary_str = sess.run(merged_summary_op)
self.summary_writer.add_summary(summary_str, current_step)

Expand Down
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def train_save_evaluate(params, kb, train_set, dev_set, ind2emoji, embeddings_ar

else:
# For visualizing using tensorboard
summary_writer = tf.train.SummaryWriter(model_folder + '/board', graph=sess.graph)
summary_writer = tf.summary.FileWriter(model_folder + '/board', graph=sess.graph)

# Keep track of how the model is training
hooks = [
Expand Down