anuragmishracse / caption_generator

A modular library built on top of Keras and TensorFlow to generate a caption in natural language for any input image.
MIT License
265 stars 120 forks source link

RuntimeError: You must compile your model before using it. #34

Open phyukhaing7 opened 5 years ago

phyukhaing7 commented 5 years ago

Running prepare_dataset.py is okay. When I run test_model.py, I found the following error. How should I change code? Please guide me!

C:\Anaconda3\envs\caption_generator-master\python.exe D:/code/Python/caption_generator-master/caption_generator/train_model.py Using TensorFlow backend. Total samples : 383454 Vocabulary size: 8256 Maximum caption length: 40 Variables initialization done! Model created! Traceback (most recent call last): File "D:/Python/caption_generator-master/caption_generator/train_model.py", line 26, in train_model(epochs=50) File "D:/code/Python/caption_generator-master/caption_generator/train_model.py", line 17, in train_model model.fit_generator(cg.data_generator(batch_size=batch_size), steps_per_epoch=cg.total_samples/batch_size, epochs=epochs, verbose=2, callbacks=callbacks_list) File "C:\Anaconda3\envs\caption_generator-master\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "C:\Anaconda3\envs\caption_generator-master\lib\site-packages\keras\engine\training.py", line 1420, in fit_generator initial_epoch=initial_epoch) File "C:\Anaconda3\envs\caption_generator-master\lib\site-packages\keras\engine\training_generator.py", line 40, in fit_generator model._make_train_function() File "C:\Anaconda3\envs\caption_generator-master\lib\site-packages\keras\engine\training.py", line 496, in _make_train_function raise RuntimeError('You must compile your model before using it.') RuntimeError: You must compile your model before using it.

Process finished with exit code 1

DuYawei512 commented 5 years ago

Excuse me, have you solved this problem?

rohith-vishnu commented 5 years ago

does anyone have a solution to this ?

Chitransh31 commented 5 years ago

Has anyone solved this problem?Please help

uguisu commented 5 years ago

I'm facing the same problem.