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

[REVIEW] Support dict output for models #98

Merged

Conversation

VibhuJawa
Copy link
Member

@VibhuJawa VibhuJawa commented Oct 25, 2024

This PR adds support for models that give dictionary output.

Other changes include:

  • Bump up CF version
  • Add worker address (to fix bug on SLURM)

Main takeaway is support below model:

class DummyModel(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, batch):
        output_size = len(batch)
        return {
            "a": torch.ones(output_size, device="cuda") * 1,
            "b": torch.ones(output_size, device="cuda") * 2,
        }

Copy link

copy-pr-bot bot commented Oct 25, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@VibhuJawa
Copy link
Member Author

VibhuJawa commented Oct 25, 2024

/okay to test

1 similar comment
@VibhuJawa
Copy link
Member Author

/okay to test

@VibhuJawa
Copy link
Member Author

/okay to test

Copy link
Contributor

@praateekmahajan praateekmahajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually makes sense, happy to approve since it's critical functionality tho would recommend

  1. adding more checks / documentation (about behavior / expectation of dict)
  2. type hint / docstring in get_model_output(..)
  3. deciding signature between model_output_col / model_output_cols (deprecating one of them)
  4. documenting behaviour of meta and expectation of dtypes when dict (same as point 1)

@VibhuJawa
Copy link
Member Author

@praateekmahajan ,

adding more checks / documentation (about behavior / expectation of dict)
Added more checks, please take a look.

type hint / docstring in get_model_output(..)
Done

deciding signature between model_output_col / model_output_cols (deprecating one of them)
Created a warning, will deprecate next release.

documenting behaviour of meta and expectation of dtypes when dict (same as point 1)

Done.

Please take another look. Thanks

Signed-off-by: Vibhu Jawa <[email protected]>
self,
path_or_name: str,
max_mem_gb: int = 16,
model_output_type: Any = ModelOutputType.NUMERIC,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but the output_type isn't Any right? It's Union[ModelOutputType, Dict[str, ModelOutputType]

Copy link
Contributor

@praateekmahajan praateekmahajan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Signed-off-by: Vibhu Jawa <[email protected]>
Signed-off-by: Vibhu Jawa <[email protected]>
@VibhuJawa
Copy link
Member Author

/okay to test

@VibhuJawa VibhuJawa merged commit 82f232f into rapidsai:main Oct 29, 2024
10 checks passed
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.

2 participants