xuangu-fang / Bayesian-Continuous-Time-Tucker-Decomposition

The code of paper : Bayesian Continuous-Time Tucker Decomposition (ICML 2022 Oral paper)
MIT License
5 stars 0 forks source link

unable to execute script_BCTT.sh #1

Closed vschram closed 8 months ago

vschram commented 8 months ago

Dear BCTT team, thanks for your work on BCTT. I am currently trying to run script_BCTT.sh but I am getting the following error:

Traceback (most recent call last): File "code_fang\LDS_tucker.py", line 95, in model.msg_update_U() File "code_fang\model_LDS_tucker_full_efficient.py", line 201, in msg_update_U E_z_del, E_z_del_2 = self.moment_kronecker_tucker(other_modes,self.ind_tr[eid],order='second') File "\code_fang\model_LDS_tucker_full_efficient.py", line 146, in moment_kronecker_tucker E_z_2 = self.post_U_v[last_mode][ind[:,last_mode]] + torch.bmm(E_z,E_z.transpose(dim0=1,dim1=2)) # NR_u*R_U RuntimeError: batch1 must be a 3D tensor

I am rather new to the topic and your paper and was wondering whether you could give me a hint at what is necessary to adapt here? Thanks in advance!

xuangu-fang commented 8 months ago

Thanks for following our work and pointing out the bug!

That bug is caused by the corner case when len(uid)=1, meaning there is only one associated entry of the given mode. The new version of NumPy and Torch seems to have different mechanisms to handle the reshaping of such corner cases, compared with the old version we used two years ago.

We have fixed it by adding shape-check code to handle the corner case at https://github.com/xuangu-fang/Bayesian-Continuous-Time-Tucker-Decomposition/blob/f660a5b7fffea5111adc083a09ab24c942ca8dee/code_fang/model_LDS_tucker_full_efficient.py#L129

The latest code should work well to run script_BCTT.sh.

Please let us know if there were further questions.

vschram commented 8 months ago

Dear Xuangu Fang,

Thanks for your swift response and fixing the bug! Could you give me some more details about the environment you are using, like the packages installed? With my current one, I get the error at another place in the code again. - It might be due to wrong packages in my conda environment.

Thanks again :) Viktoria

On Thu, Feb 29, 2024 at 2:31 PM xuangu-fang @.***> wrote:

Thanks for following our work and pointing out the bug!

That bug is caused by the corner case when len(uid)=1, meaning there is only one associated entry of the given mode. The new version of NumPy and Torch seems to have different mechanisms to handle the reshaping of such corner cases, compared with the old version we used two years ago.

We have fixed it by adding shape-check code to handle the corner case at https://github.com/xuangu-fang/Bayesian-Continuous-Time-Tucker-Decomposition/blob/f660a5b7fffea5111adc083a09ab24c942ca8dee/code_fang/model_LDS_tucker_full_efficient.py#L131

The latest code should work well to run script_BCTT.sh.

Please let us know if there were further questions.

— Reply to this email directly, view it on GitHub https://github.com/xuangu-fang/Bayesian-Continuous-Time-Tucker-Decomposition/issues/1#issuecomment-1970332628, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWSFPDK7UJMXUQR25QRHFGDYV7Y7ZAVCNFSM6AAAAABD7BQN5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQGMZTENRSHA . You are receiving this because you authored the thread.Message ID: <xuangu-fang/Bayesian-Continuous-Time-Tucker-Decomposition/issues/1/1970332628 @github.com>

xuangu-fang commented 8 months ago

Sure! I have added the environment.yaml in the repo. Some of the packages are redundant, which are used for other projects. My suggestion is to check the version of the main packages, like numpy, torch, and tensorly.

vschram commented 8 months ago

Thank you!:)

On Thu, Feb 29, 2024 at 3:30 PM xuangu-fang @.***> wrote:

Sure! I have added the environment.yaml in the repo. Some of the packages are redundant, which are used for other projects. My suggestion is to check the version of the main package, like numpy, torch, and tqdm.

— Reply to this email directly, view it on GitHub https://github.com/xuangu-fang/Bayesian-Continuous-Time-Tucker-Decomposition/issues/1#issuecomment-1970376114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWSFPDNA35U427UTC7M2IATYV776ZAVCNFSM6AAAAABD7BQN5SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQGM3TMMJRGQ . You are receiving this because you authored the thread.Message ID: <xuangu-fang/Bayesian-Continuous-Time-Tucker-Decomposition/issues/1/1970376114 @github.com>

xuangu-fang commented 8 months ago

:)