-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
huggingface: fix model
param population
#24743
huggingface: fix model
param population
#24743
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
) | ||
|
||
if values["endpoint_url"] is None and "repo_id" not in values: | ||
if "endpoint_url" not in values and "repo_id" not in values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the doc-string for the wrapper to explain which variables can be specified?
I haven't used this wrapper, but the new code does not behave correctly as far as I can tell. If repo_id is not strictly necessary for initializaiton, then a user may be relying on endpoint_url being specified via an env variable. This scenario will cause a validation error right now.
I am trying to initialize the HuggingFaceEndpoint, but despite passing the correct repo_id, I am encountering an error. I have identified the bug: even though I provide the repo_id, the HuggingFaceEndpoint validation always checks for the endpoint_url, which is incorrect. If the repo_id is passed, it should not be checking for the endpoint_url. I will create a PR to fix this issue.
Old validation does not seem to be checking endpoint_url, it seems to be loading it from the environment by default.
Possible solutions:
- Throw an error if both values can be loaded
- Only try to load_endpoint url after repo_id is missing and only then do the check that at least one of them is specified (this is still too implicit -- so bad solution)
- Change precedence order if it's obvious that repo_id should be favored over endpoint_url (too implicit -- so bad solution)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I have updated the wrapper's docstring.
-
Previously, the
endpoint_url
was first checked from environment variables. If theendpoint_url
was not set as an environment variable and onlyrepo_id
was provided, an error would occur despite therepo_id
being passed. I have now revised this behavior so that the code first checks whether the user has provided arepo_id
orendpoint_url
directly. Only after that, ifrepo_id
is not provided will it then retrieve the values from the environment variables. -
See below please.
llm = HuggingFaceEndpoint(
repo_id="microsoft/Phi-3-mini-4k-instruct", # user intend to use repo_id but validation error will be raised
for `endpoint_url` env variable missing which is wrong since user has passed repo_id
huggingfacehub_api_token = 'xxxxxx',
task="text-generation",
max_new_tokens=512,
do_sample=False,
repetition_penalty=1.03,
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a PR explaining the fix. The current fix introduces another bug in a situation where a user is relying for the endpoint URL to be loaded from the env
@eyurtsev will have a look |
raise ValueError( | ||
"Please specify either an `endpoint_url` OR a `repo_id`, not both." | ||
) | ||
if "repo_id" not in values: | ||
values["endpoint_url"] = get_from_dict_or_env( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We lost validation on repo_id being unspecified and endpoint_url being unspecified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the validation is happening above. See Line 149. @eyurtsev
@eyurtsev please see |
endpoint_url
validation fixmodel
param population
ended up rewriting the implementation to also include the |
endpoint_url
for HuggingFaceEndpoint. I have given a descriptive detail of the isse in the issue that I have created.Endpoint URL
validation Error #24742