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

How to use dataloader without NVTabular? #50

Open
bschifferer opened this issue Nov 17, 2022 · 1 comment
Open

How to use dataloader without NVTabular? #50

bschifferer opened this issue Nov 17, 2022 · 1 comment

Comments

@bschifferer
Copy link
Contributor

@radekosmulski developed the examples for dataloaders with native TensorFlow/PyTorch:#47

I wonder how do we recommend to use the dataloaders without NVTabular. When we do not use NVTabular, we do not have a dataschema, therefore, all columns are treated as an input feature.

In particular, TensorFlow keras expects that the output of the dataloader is (x, y). Currently, @radekosmulski added a parsing function: https://github.com/NVIDIA-Merlin/dataloader/blob/8157c7650248359201545934fd7d3e7f95b0eea8/examples/01a-Getting-started-Tensorflow.ipynb

label_column = 'rating'

def process_batch(data, _):
    x = {col: data[col] for col in data.keys() if col != label_column}
    y = data[label_column]
    
    return (x, y)

loader._map_fns = [process_batch]

I think the parsing function will be always required and therefore, this it not the best user experience.
Previously, the dataloader supported to parse arguments cat_names, cont_names, label_names.

I think there are multiple options:

  • Easy tool to define manually a schema
  • Enabling parameters cat_names, cont_names, label_names, etc.
  • maybe there are more?
@oliverholworthy
Copy link
Member

In this example notebook linked here.

When the Dataset is created, it automatically infers and creates a schema if not already present in the data being loaded.

The dataloader uses the TARGET tag to idenfity the target columns.

https://github.com/NVIDIA-Merlin/dataloader/blob/v0.0.2/merlin/loader/loader_base.py#L113

Based on that, it seems that the way to achieve specifying the target in this example would be to add a line to assign the target tag:

dataset.schema[label_column] = dataset.schema[label_column].with_tags(Tags.TARGET)

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

No branches or pull requests

2 participants