Skip to content

DEPR deprecate hub_utils.get_model_output#396

Merged
BenjaminBossan merged 3 commits intoskops-dev:mainfrom
adrinjalali:depr
Oct 12, 2023
Merged

DEPR deprecate hub_utils.get_model_output#396
BenjaminBossan merged 3 commits intoskops-dev:mainfrom
adrinjalali:depr

Conversation

@adrinjalali
Copy link
Copy Markdown
Member

This deprecates the function, to be removed in the next released.

Copy link
Copy Markdown
Collaborator

@BenjaminBossan BenjaminBossan left a comment

Choose a reason for hiding this comment

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

Thanks for adding this.

I'm not sure why test_push_download[pickle-False] is failing. At first I thought another rate limit, but I ran the tests a couple of times locally and they passed. Maybe it's a Windows issue.

assert np.allclose(output, y_pred)


def test_get_model_output_deprecated():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If, in the test above, you add the match to pytest.warns, this test would be completely redundant, right? This might be a worthwhile change, so that we avoid hitting the endpoint even more often. If you want to leave this as a separate test, it should have the @pytest.mark.network and @pytest.mark.inference decorators markers, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here I'm not passing any token and not passing a valid model name, so the function would fail anyway (hence the pytest.raises(Exception), therefore I don't think it even needs a network marker, and it can be in all situations and not only with a specific commit message or a merker for pytest.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see, then it's good.

"This feature is no longer free on hf.co and therefore this function will"
" be removed in the next release. Use `huggingface_hub.InferenceClient`"
" instead.",
FutureWarning,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder if DeprecationWarning is more appropriate.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

DeprecationWarning is not shown by default, but FutureWarning is, that's why in sklearn we switched to FutureWarning to make sure people actually see it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TIL. Makes sense.

# TODO: the "type: ignore" should eventually become unncessary when hf_hub
# is updated
warnings.warn(
"This feature is no longer free on hf.co and therefore this function will"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Technically speaking, it's still free, just heavily rate-limited.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So it's not free 😁

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A philosophical question...

Copy link
Copy Markdown
Member Author

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

I'm not sure why test_push_download[pickle-False] is failing. At first I thought another rate limit, but I ran the tests a couple of times locally and they passed. Maybe it's a Windows issue.

Can figure that out in another PR probably :)

"This feature is no longer free on hf.co and therefore this function will"
" be removed in the next release. Use `huggingface_hub.InferenceClient`"
" instead.",
FutureWarning,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

DeprecationWarning is not shown by default, but FutureWarning is, that's why in sklearn we switched to FutureWarning to make sure people actually see it.

assert np.allclose(output, y_pred)


def test_get_model_output_deprecated():
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here I'm not passing any token and not passing a valid model name, so the function would fail anyway (hence the pytest.raises(Exception), therefore I don't think it even needs a network marker, and it can be in all situations and not only with a specific commit message or a merker for pytest.

# TODO: the "type: ignore" should eventually become unncessary when hf_hub
# is updated
warnings.warn(
"This feature is no longer free on hf.co and therefore this function will"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So it's not free 😁

# TODO: the "type: ignore" should eventually become unncessary when hf_hub
# is updated
warnings.warn(
"This feature is no longer free on hf.co and therefore this function will"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A philosophical question...

"This feature is no longer free on hf.co and therefore this function will"
" be removed in the next release. Use `huggingface_hub.InferenceClient`"
" instead.",
FutureWarning,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TIL. Makes sense.

assert np.allclose(output, y_pred)


def test_get_model_output_deprecated():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see, then it's good.

@adrinjalali
Copy link
Copy Markdown
Member Author

@BenjaminBossan so should we merge?

@BenjaminBossan BenjaminBossan merged commit 98541de into skops-dev:main Oct 12, 2023
@adrinjalali adrinjalali deleted the depr branch October 12, 2023 14:40
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