Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Sep 25, 2023
1 parent 92b1562 commit f0e6a96
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/huggingface_hub/inference/_text_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,13 @@ def raise_text_generation_error(http_error: HTTPError) -> NoReturn:
# If error_type => more information than `hf_raise_for_status`
if error_type is not None:
if error_type == "generation":
raise GenerationError(message, request=http_error.request, response=http_error.response) from http_error
raise GenerationError(message) from http_error # type: ignore
if error_type == "incomplete_generation":
raise IncompleteGenerationError(
message, request=http_error.request, response=http_error.response
) from http_error
raise IncompleteGenerationError(message) from http_error # type: ignore
if error_type == "overloaded":
raise OverloadedError(message, request=http_error.request, response=http_error.response) from http_error
raise OverloadedError(message) from http_error # type: ignore
if error_type == "validation":
raise ValidationError(message, request=http_error.request, response=http_error.response) from http_error
raise ValidationError(message) from http_error # type: ignore

# Otherwise, fallback to default error
raise http_error

0 comments on commit f0e6a96

Please sign in to comment.