Hi everyone! I’m new to BayesFlow and new-ish to ML in general, so maybe this is a stupid question.
I’m trying to run someone else’s code, but I’m always getting an error message when trying to run EquivariantLayer(). This is the error message I’m getting:
Traceback (most recent call last):
File “C:\\Users\\####\\Desktop\\ABI-graph-paper\\case_study_toy\\toy_run_simulation.py”, line 260, in
sum_net_ds_mp = DeepSetMeanPooling(summary_dim=16, mlp_widths_equivariant=(64,64))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper\\case_study_toy..\\summary_networks\\DeepSetMeanPooling.py”, line 92, in **init**
equivariant_module = EquivariantLayer(
^^^^^^^^^^^^^^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper.venv\\Lib\\site-packages\\bayesflow\\networks\\deep_set\\equivariant_layer.py”, line 78, in **init**
self.invariant_module = InvariantLayer(
^^^^^^^^^^^^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper.venv\\Lib\\site-packages\\bayesflow\\networks\\deep_set\\invariant_layer.py”, line 70, in **init**
self.inner_fc = MLP(
^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper.venv\\Lib\\site-packages\\bayesflow\\networks\\mlp\\mlp.py”, line 74, in **init**
block = self.\_make_block(
^^^^^^^^^^^^^^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper.venv\\Lib\\site-packages\\bayesflow\\networks\\mlp\\mlp.py”, line 129, in \_make_block
return Residual(\*layers)
^^^^^^^^^^^^^^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper.venv\\Lib\\site-packages\\bayesflow\\networks\\residual\\residual.py”, line 23, in **init**
self.projector = keras.layers.Dense(units=None, name=“projector”)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\\Users\\####\\Desktop\\ABI-graph-paper.venv\\Lib\\site-packages\\keras\\src\\layers\\core\\dense.py”, line 101, in **init**
raise ValueError(
ValueError: Received an invalid value for units, expected a positive integer. Received: units=None
So BayesFlow sets units=None, even though Keras only allows positive integers? Am I missing something? I first thought this was maybe a compatibility issue with the versions I have installed, but older Keras versions also don’t allow None values for units.
In case it matters, I’m using Python 3.12.4, BayesFlow 2.0.7 with TensorFlow 2.20.0 backend and Keras 3.13.0.
ETA: In the meantime, I found that it works without raising an error with the latest dev version of BayesFlow, even though I still don’t understand what causes this error in the first place