KarchinLab / mhcnuggets

MHC Class I and Class II neoantigen binding prediction
Other
26 stars 10 forks source link

Tensorflow 2.16.1 compatibility #38

Open Stikus opened 8 months ago

Stikus commented 8 months ago

Hello, as you can see in pVACtools issue https://github.com/griffithlab/pVACtools/issues/1084 - https://github.com/openvax/mhcflurry and mhcnuggets doesn't work with latest 2.16.1 version of tensorflow.

Exception: An error occurred while calling MHCnuggets:
/usr/local/lib/python3.10/dist-packages/keras/src/layers/core/masking.py:47: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.
  super().__init__(**kwargs)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pvactools/lib/call_mhcnuggets.py", line 84, in <module>
    main()
  File "/usr/local/lib/python3.10/dist-packages/pvactools/lib/call_mhcnuggets.py", line 61, in main
    predict(args.class_type, tmp_file.name, mhcnuggets_allele(args.allele, args.class_type), output=tmp_output_file.name, rank_output=True)
  File "/usr/local/lib/python3.10/dist-packages/mhcnuggets/src/predict.py", line 93, in predict
    model.compile(loss='mse', optimizer=Adam(lr=0.001))
  File "/usr/local/lib/python3.10/dist-packages/keras/src/optimizers/adam.py", line 60, in __init__
    super().__init__(
  File "/usr/local/lib/python3.10/dist-packages/keras/src/backend/tensorflow/optimizer.py", line 19, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/keras/src/optimizers/base_optimizer.py", line 38, in __init__
    raise ValueError(f"Argument(s) not recognized: {kwargs}")
ValueError: Argument(s) not recognized: {'lr': 0.001}

Looks like some legacy code stopped working: https://github.com/KarchinLab/mhcnuggets/blob/master/mhcnuggets/src/predict.py#L90-L93

Maybe tensorflow version should be pinned until code is fixed?

Similar https://github.com/openvax/mhcflurry/issues/234 issue.

indapa commented 5 months ago

I was facing the same issue. Should I install another version of TensorFlow?