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

AssertionError: Please install transformers for generate functionality. pip install transformers. #66

Open
llstela opened this issue Sep 7, 2024 · 4 comments

Comments

@llstela
Copy link

llstela commented Sep 7, 2024

I use the following commands to prepare the environment.

conda create -n pasd python=3.10
conda activate pasd
pip install -r requirements.txt

Because SD-1.5 is not available, so I downloaded SDXL. And then run

python test_pasd_sdxl.py

The terminal outputs:

Traceback (most recent call last):
File "/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py", line 316, in
main(args)
File "/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py", line 226, in main
validation_prompt = get_validation_prompt(args, validation_image, model, preprocess, category)
File "/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py", line 176, in get_validation_prompt
generated = model.generate(image)
File "/opt/conda/envs/pasd/lib/python3.10/site-packages/open_clip/coca_model.py", line 224, in generate
assert _has_transformers, "Please install transformers for generate functionality. pip install transformers."
AssertionError: Please install transformers for generate functionality. pip install transformers.

However, the "transformers" has been installed as in requirements.txt. Therefore, something might be wrong with open_clip_torch and transformers. Please check.

@yangxy
Copy link
Owner

yangxy commented Sep 9, 2024

Update the diffusers and open_clip_torch to the latest version. I will update the requirements.txt soon

@ch3nboyu
Copy link

I did this, but it occurs again

@ch3nboyu
Copy link

I use the following commands to prepare the environment.我使用以下命令来准备环境。

conda create -n pasd python=3.10
conda activate pasd conda 激活 PASD
pip install -r requirements.txt

Because SD-1.5 is not available, so I downloaded SDXL. And then run因为 SD-1.5 不可用,所以我下载了 SDXL。然后运行

python test_pasd_sdxl.py

The terminal outputs: 终端输出:

Traceback (most recent call last):回溯 (最近调用最后):
File "/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py", line 316, in 文件 “/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py”,第 316 行,在
main(args) main(args)
File "/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py", line 226, in main文件 “/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py”,第 226 行,在主
validation_prompt = get_validation_prompt(args, validation_image, model, preprocess, category)validation_prompt = get_validation_prompt(args, validation_image, model, preprocess, category)
File "/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py", line 176, in get_validation_prompt文件 “/gdata/hot1/shengxuhan/codes/SuperResolution/PASD/test_pasd_sdxl_edited.py”,第 176 行,get_validation_prompt
generated = model.generate(image)生成 = model.generate(image)
File "/opt/conda/envs/pasd/lib/python3.10/site-packages/open_clip/coca_model.py", line 224, in generate文件 “/opt/conda/envs/pasd/lib/python3.10/site-packages/open_clip/coca_model.py”,第 224 行,生成
assert _has_transformers, "Please install transformers for generate functionality. pip install transformers."assert _has_transformers,“请安装变压器以实现生成功能。pip install transformers
AssertionError: Please install transformers for generate functionality. pip install transformers.AssertionError:请安装变压器以实现生成功能。pip install transformers 安装变压器

However, the "transformers" has been installed as in requirements.txt. Therefore, something might be wrong with open_clip_torch and transformers. Please check.但是,“变压器”的安装与 requirements.txt 相同。因此,open_clip_torchtransformer 可能有问题。请检查。

Upgrading transformers to version 4.44.2 temporarily worked, although it conflicted with salesforce-lavis.

@shengkelala
Copy link

transformers升级到最新可以解决,但是会和salesforce-lavis1.0.2冲突

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

No branches or pull requests

4 participants