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

[ENH] allow passing of transformer object to hugging face transformer #6642

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Spinachboul
Copy link

@fkiraly & @benHeid
Invoking model object for the Issue #6561

@@ -101,7 +102,8 @@ class HFTransformersForecaster(BaseForecaster):

def __init__(
self,
model_path: str,
model_path: str = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I would propose to use in future only model and set a deprecation warning for model_path because in my opinion this additional kwarg is not necessary, since model_path and model has basically the same meaning.
@fkiraly any opinions

Copy link
Author

Choose a reason for hiding this comment

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

@benHeid
If that is the case, can we import the warnings dependency in the start?
Would it interfere in the checks during build process?

Copy link
Contributor

@benHeid benHeid left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Beside the change requests, please also rebase on the main branch, sine the progress bar changes are part of a different PR.

)
if self.model is None and self.model_path is not None:
# Load model and extract config
config = AutoConfig.from_pretrained(self.model_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would propose to move the model loading functionality into a private method to keep the fit method simpler. E.g. into a method _load_model

@fkiraly fkiraly changed the title Invoke Model Object [ENH] allow passing of transformer object to hugging face transformer Jun 21, 2024
@Spinachboul
Copy link
Author

@benHeid | @fkiraly | @achieveordie | @yarnabrina
I have

  • Added the load_model private function which is called by the _fit_ method
  • Also addedn the deprecation warning for using model_path

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.

None yet

2 participants