Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M2 / sktime 0.22 / Python 3.11 #56

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

richarddli
Copy link

I was able to get the regression example running with the following branches, plus a weird monkey patch on PyTorch, which was to remove the is_causal=is_causal flag on line 315 in transformers.py. (Apparently is_causal is a hint, but PyTorch kept on complaining how is_causal was an unexpected kwarg.)

This took me a few hours to debug, so I thought I'd share this with others in case they're trying out this library. I wouldn't merge this as-is due to the PyTorch monkey patch required.

BUT ... with the patches below, I'm able to run on Apple Silicon with a fully modern Python & dependency stack. (The problem with the pinned versions is that there are no wheels of the older binaries for Apple Silicon.)

@richarddli
Copy link
Author

I shared this too soon! With the BeijingPM 25 dataset, I get:

2023-08-24 15:15:29,239 | INFO : Epoch 0 Validation Summary: epoch: 0.000000 | loss: 31485.421528 |
Traceback (most recent call last):
  File "/Users/rdl/amorphous/mvts_transformer/src/main.py", line 307, in <module>
    main(config)
  File "/Users/rdl/amorphous/mvts_transformer/src/main.py", line 235, in main
    aggr_metrics_val, best_metrics, best_value = validate(val_evaluator, tensorboard_writer, config, best_metrics,
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rdl/amorphous/mvts_transformer/src/running.py", line 222, in validate
    np.savez(pred_filepath, **per_batch)
  File "/Users/rdl/miniconda3/envs/mvts2/lib/python3.11/site-packages/numpy/lib/npyio.py", line 639, in savez
    _savez(file, args, kwds, False)
  File "/Users/rdl/miniconda3/envs/mvts2/lib/python3.11/site-packages/numpy/lib/npyio.py", line 740, in _savez
    val = np.asanyarray(val)
          ^^^^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (79,) + inhomogeneous part.

@richarddli
Copy link
Author

The proximate cause of the error above is because the last nparray in the list of predictions & targets is not the same as the other nparrays in the list.

I've implemented a hack which drops the last array. I ran the AppEnergy data set with and without the patch, and the accuracy doesn't seem to be affected dramatically. If someone else has insight as to the correct fix, I'd be grateful!

In the meantime, I'm implementing my own custom data classes ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant