ML4GLand / EUGENe

Elucidating the Utility of Genomic Elements with Neural Nets
MIT License
65 stars 4 forks source link

ValueError: Shape of passed values is (2274, 10), indices imply (2274, 18) #47

Open X02cinnamondirty opened 8 months ago

X02cinnamondirty commented 8 months ago
evaluate.predictions_sequence_module(
...         best_model,
...         sdata=sd_test,
...         seq_var="ohe_seq",
...         target_vars="qseqid_x",
...         batch_size=128,
...         gpus=1,
...         in_memory=True,
...         name="LTRidentity",
...         version="0.75",
...         file_label="test",
...         prefix=f"LTRidentity_",
...         transforms={"ohe_seq": lambda x: x.swapaxes(1, 2)},
...         num_workers=63
...     )
Loading ohe_seq and ['qseqid_x'] into memory
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
HPU available: False, using: 0 HPUs
Predicting DataLoader 0: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 18/18 [00:00<00:00, 70.29it/s]Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/eugene/evaluate/_predict.py", line 146, in predictions_sequence_module
    preds = predictions(
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/eugene/evaluate/_predict.py", line 62, in predictions
    ps = np.concatenate(predictor.predict(model, dataloader), axis=0)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 864, in predict
    return call._call_and_handle_interrupt(
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/trainer/call.py", line 44, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 903, in _predict_impl
    results = self._run(model, ckpt_path=ckpt_path)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 989, in _run
    results = self._run_stage()
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1030, in _run_stage
    return self.predict_loop.run()
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/loops/utilities.py", line 182, in _decorator
    return loop_run(self, *args, **kwargs)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/loops/prediction_loop.py", line 128, in run
    return self.on_run_end()
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/loops/prediction_loop.py", line 200, in on_run_end
    results = self._on_predict_epoch_end()
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/loops/prediction_loop.py", line 357, in _on_predict_epoch_end
    call._call_callback_hooks(trainer, "on_predict_epoch_end")
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/trainer/call.py", line 208, in _call_callback_hooks
    fn(trainer, trainer.lightning_module, *args, **kwargs)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pytorch_lightning/callbacks/prediction_writer.py", line 156, in on_predict_epoch_end
    self.write_on_epoch_end(trainer, pl_module, trainer.predict_loop.predictions, epoch_batch_indices)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/eugene/evaluate/_utils.py", line 20, in write_on_epoch_end
    pred_df = pd.DataFrame(data=outputs, columns=pred_cols + target_cols)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pandas/core/frame.py", line 721, in __init__
    mgr = ndarray_to_mgr(
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pandas/core/internals/construction.py", line 349, in ndarray_to_mgr
    _check_values_indices_shape_match(values, index, columns)
  File "/home/xiongzx/.conda/envs/eugene/lib/python3.9/site-packages/pandas/core/internals/construction.py", line 420, in _check_values_indices_shape_match
    **raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
ValueError: Shape of passed values is (2274, 10), indices imply (2274, 18)**

my output_dim is 9

adamklie commented 8 months ago

Can you provide the output of sd_test["qseqid_x"].values.shape?