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 end-to-end HuggingFace Example #758

Draft
wants to merge 11 commits into
base: language
Choose a base branch
from
Draft

Add end-to-end HuggingFace Example #758

wants to merge 11 commits into from

Conversation

kurbanrita
Copy link
Collaborator

@kurbanrita kurbanrita commented Feb 5, 2025

Add functionality to run HuggingFace models on text data.

  • Add validate function to the interface that runs validation without fitting
  • Add TextModule for LLMs
  • Add HuggingFace wrapper
  • Add configuration for a simple validation task
  • Add tests

@kurbanrita kurbanrita changed the base branch from main to language February 5, 2025 15:42
@kurbanrita kurbanrita self-assigned this Feb 6, 2025
@kurbanrita kurbanrita requested a review from ioangatop February 6, 2025 15:34
Copy link
Collaborator

@ioangatop ioangatop left a comment

Choose a reason for hiding this comment

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

Great work! this is some first review mostly about styling

Comment on lines 124 to 132
key: str(value) if value is not None else ""
for key, value in {
"year": sample.get("YEAR"),
"labels": sample.get("LABELS"),
"meshes": sample.get("MESHES"),
"long_answer": sample.get("LONG_ANSWER"),
"reasoning_required": sample.get("reasoning_required_pred"),
"reasoning_free": sample.get("reasoning_free_pred"),
}.items()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can keep it simple

return {
    "year": sample.get("YEAR", ""),
    "labels": sample.get("LABELS", ""),
    ...
}

or more complicated

return {
    key.lower().removesuffix("_pred"): sample.get(key, "")
    for key in ("YEAR", "LABELS", ...)
}

IMO simple is enough and more readable :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tested it and if a key exists in the sample but the value is None, then sample.get(key, "") will still return None, which is what I try to avoid. Maybe I'll use "year": sample.get("YEAR") or "",? what do you think?

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