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

Expound error on recursively_apply #1286

Merged
merged 2 commits into from
Apr 3, 2023
Merged

Expound error on recursively_apply #1286

merged 2 commits into from
Apr 3, 2023

Conversation

muellerzr
Copy link
Collaborator

Expands the error a bit more in recursively_apply to be more straightforward. Example:

Traceback (most recent call last):
  File "/home/zach_mueller_huggingface_co/test_distrib.py", line 6, in <module>
    gathered_tensor, i = accelerator.gather((process_tensor, 1))
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/accelerator.py", line 1869, in gather
    return gather(tensor)
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/utils/operations.py", line 243, in gather
    return _gpu_gather(tensor)
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/utils/operations.py", line 223, in _gpu_gather
    return recursively_apply(_gpu_gather_one, tensor, error_on_other_type=True)
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/utils/operations.py", line 97, in recursively_apply
    return honor_type(
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/utils/operations.py", line 71, in honor_type
    return type(obj)(generator)
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/utils/operations.py", line 100, in <genexpr>
    recursively_apply(
  File "/home/zach_mueller_huggingface_co/accelerate/src/accelerate/utils/operations.py", line 118, in recursively_apply
    raise TypeError(
TypeError: Unsupported types (<class 'int'>) passed to `_gpu_gather_one`. Only nested list/tuple/dicts of objects that are valid for `is_torch_tensor` should be passed.

cc @stas00

@muellerzr muellerzr requested a review from sgugger April 3, 2023 16:50
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 3, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@stas00 stas00 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 making the error more user-friendly, Zach.

@muellerzr muellerzr merged commit 2117078 into main Apr 3, 2023
@muellerzr muellerzr deleted the expound-err branch April 3, 2023 18:07
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.

4 participants