-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
ImportError: cannot import name 'randn_tensor' from 'diffusers.utils' #5025
Comments
Hi @Zerg-Overmind. We moved
|
@DN6 seems to me we can close this issue no? |
Fixes import huggingface/diffusers#5025 <!-- Open the PR up as a draft until you feel it is ready for a proper review. Do not make PR:s from your own `main` branch, as that makes it difficult for reviewers to add their own fixes. Add any improvements to the branch as new commits to make it easier for reviewers to follow the progress. All commits will be squashed to a single commit once the PR is merged into `main`. Make sure you mention any issues that this PR closes in the description, as well as any other related issues. To get an auto-generated PR description you can put "copilot:summary" or "copilot:walkthrough" anywhere. --> ### What ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [ ] I have tested [demo.rerun.io](https://demo.rerun.io/pr/{{ pr.number }}) (if applicable) - [PR Build Summary](https://build.rerun.io/pr/{{ pr.number }}) - [Docs preview](https://rerun.io/preview/{{ pr.commit }}/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/{{ pr.commit }}/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://ref.rerun.io/dev/bench/) - [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
@DN6 @sayakpaul FYI this breaks a few things - for e.g. I just tried to use TRL for something and get an error thanks to this:
Might be worth looking through at least the HF libs looking for |
Similar behaviour for me from trl import SFTTrainer
File [~/miniconda3/envs/book/lib/python3.10/site-packages/trl/__init__.py:7](https://file+.vscode-resource.vscode-cdn.net/home/osanseviero/Desktop/workspace/genai/nbs/~/miniconda3/envs/book/lib/python3.10/site-packages/trl/__init__.py:7)
5 from .core import set_seed
6 from .environment import TextEnvironment, TextHistory
----> 7 from .extras import BestOfNSampler
8 from .import_utils import is_diffusers_available, is_peft_available
9 from .models import (
10 AutoModelForCausalLMWithValueHead,
11 AutoModelForSeq2SeqLMWithValueHead,
12 PreTrainedModelWrapper,
13 create_reference_model,
14 )
File [~/miniconda3/envs/book/lib/python3.10/site-packages/trl/extras/__init__.py:16](https://file+.vscode-resource.vscode-cdn.net/home/osanseviero/Desktop/workspace/genai/nbs/~/miniconda3/envs/book/lib/python3.10/site-packages/trl/extras/__init__.py:16)
1 # flake8: noqa
2
3 # Copyright 2022 The HuggingFace Team. All rights reserved.
(...)
...
(...)
42
43 """
ImportError: cannot import name 'randn_tensor' from 'diffusers.utils' (/home/osanseviero/miniconda3/envs/book/lib/python3.10/site-packages/diffusers/utils/__init__.py) cc @lvwerra as well |
pip install diffusers==0.18.0 works fine. |
Diffusers changed their API huggingface/diffusers#5025
Describe the bug
In the newest version, whenever you run: from diffusers.utils import randn_tensor
you will get the error: importError: cannot import name 'randn_tensor' from 'diffusers.utils'
But you can fix this by adding "from .torch_utils import randn_tensor" to your pythonxx/site-packages/diffusers/utils/init.py" after installing the diffusers....
Reproduction
run "from diffusers.utils import randn_tensor" after installing the latest version
Logs
No response
System Info
diffusers 0.21.0
Who can help?
No response
The text was updated successfully, but these errors were encountered: