I've been having some problems with TensorFlow and Pyinstaller. My app works just fine on the terminal, but when I try to bundle it, it keeps crashing. The interface loads out, but when I try to predict some data with TensorFlow I get the error message: ModuleNotFoundError: No module named 'tensorflow.python.keras.engine.base_layer_v1'. Has someone had this problem before? Do you guys know how to solve it?
import tensorflow as tf
from tensorflow.keras.layers import Input, Dense, Lambda
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
import keras.engine #I have tried this, but it did not work
(...)
def model_creator(loss_function, opt):
# Define inputs with predefined shape
inputs = Input(shape=(5,)) # <<<The error occurred at this line>>>
# Build network
Layer1 = Dense(units=20, activation = 'sigmoid')
Layer2 = Dense(units=20, activation = 'sigmoid')
output1 = Layer1(inputs)
#output2 = Layer2(output1)
last_output = Layer2(output1)
# Predict the parameters
outputs = Dense(2)(last_output)
# Construct model
model = Model(
inputs=inputs,
outputs=outputs
)
model.compile(
loss = loss_function,
optimizer = opt
)
return model
(...)