NVIDIA-Merlin / Transformers4Rec

Transformers4Rec is a flexible and efficient library for sequential and session-based recommendation and works with PyTorch.
https://nvidia-merlin.github.io/Transformers4Rec/main
Apache License 2.0
1.12k stars 148 forks source link

[BUG]ModuleNotFoundError: No module named 'transformers4rec.utils.data_utils' #662

Closed jingxie-Richard closed 1 year ago

jingxie-Richard commented 1 year ago

Bug description

Followed this tutorial: https://github.com/NVIDIA-Merlin/Transformers4Rec/blob/main/examples/tutorial/02-ETL-with-NVTabular.ipynb, and then when executing this code block: from transformers4rec.utils.data_utils import save_time_based_splits save_time_based_splits(data=nvt.Dataset(sessions_gdf), output_dir= OUTPUT_FOLDER, partition_col=PARTITION_COL, timestamp_col='user_session', )

I faced ModuleNotFoundError: No module named 'transformers4rec.utils.data_utils' error. I only found one relevant issue: https://github.com/NVIDIA-Merlin/Transformers4Rec/issues/629 and tried to follow that solution. But still did not solve the problem. Now I installed the latest version: import transformers4rec

print(transformers4rec.version)

version: 23.02.00

Steps/Code to reproduce bug

Expected behavior

Environment details

Additional context

rnyak commented 1 year ago

@jingxie-Richard hello. this is not a bug. this happens bcs you install Merlin's latest stable versions but you use the notebooks from the main branch. How do you install Merlin libraries? via pip? or do you use docker image?

if you install via pip, I recommend you to start from a clean env and then install Merlin libs again via pip. Do not use the notebooks from main branch. Please use the notebooks from release-23.02 branch.

then if you do from transformers4rec.data.preprocessing import save_time_based_splits it should work.

jingxie-Richard commented 1 year ago

@rnyak thank you very much for your reply! I installed Merlin libraries via pip since my working environment is Databricks GPU cluster which does not support the Merlin docker image. I did start from a clean env when I faced the above issue. I will use the notebooks from release-23.02 branch and try it again. If I have any problems, I will update it.

jingxie-Richard commented 1 year ago

@rnyak I just tested the notebooks from release-23.02 branch and they works. Thanks again!