NVIDIA-Merlin / NVIDIA-Merlin/Transformers4Rec
[DOC] ValueError: For Item Prediction task a categorical_module including an item_id column is required.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 165
- Avg merge
- 1m
- Merged PRs (30d)
- 2
Description
Report incorrect documentation
Location of incorrect documentation
Describe the problems or issues found in the documentation
Code in question:

Running the code indicated above to instantiate the model results in the following traceback:
File "/home/jason/conda/envs/candid/lib/python3.9/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "/home/jason/conda/envs/candid/lib/python3.9/site-packages/transformers4rec/config/transformer.py", line 58, in to_torch_model
return torch4rec.Head(
File "/home/jason/conda/envs/candid/lib/python3.9/site-packages/transformers4rec/torch/model/base.py", line 278, in __init__
self.build(inputs=inputs, task_blocks=task_blocks)
File "/home/jason/conda/envs/candid/lib/python3.9/site-packages/transformers4rec/torch/model/base.py", line 305, in build
task.build(self.body, input_size, inputs=inputs, device=device, task_block=task_block)
File "/home/jason/conda/envs/candid/lib/python3.9/site-packages/transformers4rec/torch/model/prediction_task.py", line 178, in build
raise ValueError(
ValueError: For Item Prediction task a categorical_module including an item_id column is required.
I looked in the source code and it seems that is expecting there to literally be a column called item_id which is fine (but flexibility in column names would be helpful), however, I'm not sure how it fits in with the way the features were preprocessed in earlier steps and notebooks (those in examples/getting-started-session-based)where we aggregate across a session and take things like item counts and such (see below, source)

Steps taken to verify documentation is incorrect
It may not be incorrect, it is just unclear what form/shape the data should be in, in order to run NextItemPredictionTask
Suggested fix for documentation
Some kind of documentation showing what the data should look like for this task.
Report needed documentation
Report needed documentation
Describe the documentation you'd like
Steps taken to search for needed documentation**
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with examples/getting-started-session-based/02-session-based-XLNet-with-PyT.ipynb and compare its model setup with the preprocessing in 01-ETL-with-NVTabular.ipynb. Trace how NextItemPredictionTask receives categorical features, especially the required item_id column, then document the expected data shape and update the example so it runs without the reported ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- huggingface, python, pytorch
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100