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

Add support for FineTune-Guard classifier #397

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

sarahyurick
Copy link
Collaborator

Copy of #325.

Awaiting Hugging Face release here: https://huggingface.co/nvidia/FineTune-Guard

Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
@sarahyurick sarahyurick marked this pull request as ready for review November 27, 2024 21:19
Comment on lines +183 to +188
weights_path = hf_hub_download(
repo_id=self.config.finetune_guard_path,
filename="model.safetensors",
)
state_dict = load_file(weights_path)
model.finetune_guard_net.load_state_dict(state_dict)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This part needed to be updated; it was previously:

model.finetune_guard_net.load_state_dict(
    torch.load(self.config.finetune_guard_path, weights_only=True)
)

However, torch.load only works on local files and cannot pull from Hugging Face.

Copy link
Collaborator

@ayushdg ayushdg left a comment

Choose a reason for hiding this comment

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

Im not too familiar with this part of the codebase but nothing obvious stands out, lgtm!

@sarahyurick sarahyurick merged commit b15b08a into NVIDIA:main Nov 27, 2024
3 checks passed
ruchaa-apte pushed a commit to ruchaa-apte/NeMo-Curator that referenced this pull request Dec 13, 2024
* add changes from NVIDIA#325

Signed-off-by: Sarah Yurick <[email protected]>

* edit state_dict read

Signed-off-by: Sarah Yurick <[email protected]>

---------

Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Rucha Apte <[email protected]>
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