# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## Loading the Data

# +
import pickle

x = pickle.load(open('embeddings.pickle', 'rb'))
y = pickle.load(open('labels.pickle', 'rb'))

# +
from sklearn.model_selection import train_test_split

x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=.1)
# -

# ## Building the model

import tensorflow as tf

# +
model = tf.keras.Sequential()

model.add(tf.keras.layers.Embedding(1000, 64, input_length=512))
model.add(tf.keras.layers.LSTM(100))
#model.add(tf.keras.layers.Flatten())
model.add(tf.keras.layers.Dense(2, activation='softmax'))

model.compile(
    loss='binary_crossentropy',
    optimizer='adam', 
    metrics=['accuracy']
)

print(model.summary()) 
# -

model.fit(x_train, y_train, validation_data=(x_test, y_test), nb_epoch=3, batch_size=64)

# # I can't belive that I failed again!



StarcoderdataJupyterScriptsDedupFiltered