Open pxc2575 opened 1 month ago
Looking at the error, I would guess that you don't have any binary predicates. Params shape: [64,2,1,0]
means the tensor is empty. You have a batch size of 64, 2 constants / objects, 1 other object but 0 binary predicates. The original experiments always had binary predicates.
To fix this, it might be easier to just add 1 binary predicate to learn if you can. Otherwise, you may also be able to comment out:
# This is where the error is
perm_binary = tf.gather_nd(
inputs["binary"], repeat_bidxs, batch_dims=1
) # (B, K, V, V-1, P2)
# ---------------------------
# Compute flattened input
in_tensor = flatten_concat(
# You may then remove perm_binary
[perm_nullary, perm_unary, perm_binary], batch_dims=2
)
I say may, because I don't remember whether the downstream elements and parameters make computations for binary predicates.
The expected input to these layers are:
{'nullary_preds': (B, P0), 'unary_preds': (B, N, P1), 'binary_preds': (B, N, N-1, P2)}
and probably assume they are non-empty tensors.
I printed the input tensor, and all my parameter settings are the default settings from the original experiment. However, the program doesn't run when I comment out that code snippet. How can I add a binary predicate for learning? repeat_bidxs (None, 2, 2, 1, 2) inputs[binary] (None, 2, 1, 8) repeat_bidxs (None, 2, 2, 1, 2) inputs[binary] (None, 2, None, 0) art_dir data\active_runs\20240721-202400\8f1d95344847441da026dcb638658a82 INFO:main:Model has 2776 many parameters. INFO:main:Local artifact dir is data\active_runs\20240721-202400\8f1d95344847441da026dcb638658a82 INFO:main:Saving task description to data\active_runs\20240721-202400\8f1d95344847441da026dcb638658a82\task_description.json INFO:main:Starting training. repeat_bidxs (None, 2, 2, 1, 2) inputs[binary] (None, 2, 1, 8) repeat_bidxs (None, 2, 2, 1, 2) inputs[binary] (None, 2, None, 0) repeat_bidxs (None, 2, 2, 1, 2) inputs[binary] (None, 2, 1, 8) repeat_bidxs (None, 2, 2, 1, 2) inputs[binary] (None, 2, None, 0) 2024-07-21 20:24:13.352765: W tensorflow/core/framework/op_kernel.cc:1828] OP_REQUIRES failed at gather_nd_op.cc:48 : INVALID_ARGUMENT: Requested more than 0 entries, but params is empty. Params shape: [64,2,1,0]
THe number of nullary, unary and binary relations are specificied with the arities
configuration. When the experiments.py
is run it generates configurations which uses different number of predicates. It is specificied as an array [0,0,1,1,1,2,2]
which means 2 nullary, 3 unary and 2 binary predicates.