theislab / tcellmatch

BSD 3-Clause "New" or "Revised" License
37 stars 7 forks source link

Error in tutorial - max_steps_per_epoch #1

Open CurlsForScience opened 3 years ago

CurlsForScience commented 3 years ago

Hello,

I believe there is an error in the tutorial Tutorial_for_iedb_dataset.ipynb. For the following command, I believe "steps_per_epoch" should be "max_steps_per_epoch" according to the source code.

ffn.train( epochs=1, steps_per_epoch=1, batch_size=8 )

Additionally, when going through the tutorial, I get an error on the following command.

print(ffn.model.summary()) AttributeError: 'ModelSa' object has no attribute 'summary'

I also get an error with the following command. ffn2.load_model(fn_tmp) Traceback (most recent call last): File "", line 1, in TypeError: load_model() missing 1 required positional argument: 'fn_model'

I believe this error arises since load_model requires two arguments, fn_settings and fn_model. I was able to work around this error using save_model_full and specifying save_train_data=True. If I do not specify save_train_data=True, errors arise regarding the x_train.shape which is not saved otherwise. Then I used load_model_full instead of load_model. However, the ffn2.evaluate() takes a very long time after this.

I appreciate any help you can give me on troubleshooting these errors.

davidsebfischer commented 3 years ago

Thanks for the issue!

I believe there is an error in the tutorial Tutorial_for_iedb_dataset.ipynb. For the following command, I believe "steps_per_epoch" should be "max_steps_per_epoch" according to the source code.

That sounds reasonable.

Additionally, when going through the tutorial, I get an error on the following command.

print(ffn.model.summary()) AttributeError: 'ModelSa' object has no attribute 'summary'

Looks like a error in the tutorial indeed, you want this summary, check out the keras model instance ModelSa.training_model https://github.com/theislab/tcellmatch/blob/ddd344e44147f97f35d6a4e7c3c7677981fd177e/tcellmatch/models/models_ffn.py#L325

I also get an error with the following command. ffn2.load_model(fn_tmp) Traceback (most recent call last): File "", line 1, in TypeError: load_model() missing 1 required positional argument: 'fn_model'

I believe this error arises since load_model requires two arguments, fn_settings and fn_model. I was able to work around this error using save_model_full and specifying save_train_data=True. If I do not specify save_train_data=True, errors arise regarding the x_train.shape which is not saved otherwise. Then I used load_model_full instead of load_model. However, the ffn2.evaluate() takes a very long time after this.

Indeed! https://github.com/theislab/tcellmatch/blob/ddd344e44147f97f35d6a4e7c3c7677981fd177e/tcellmatch/estimators/estimator_ffn.py#L1437 takes the hyperparameter file and the weight file. I think you could do sth like

You dont need to reload data to reuse a model, you can of course. if evaluate takes long it just means that your data or model is big for your hardware.