tgxs002 / HPSv2

Human Preference Score v2: A Solid Benchmark for Evaluating Human Preferences of Text-to-Image Synthesis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Having issues with using v2.1 inference

PHOENIXFURY007 opened this issue · comments

TypeError: score() got an unexpected keyword argument 'hps_version'
I got this error while trying to run the code .
result = hpsv2.score(images[i], captions[i],hps_version="v2.1")
I am trying to run multiple inference at the same time

Did you pull the newest version? It works fine on my device by running the following code:

score = hpsv2.score('path/to/assests/demo_image.jpg' , 'cat with horn',  hps_version='v2.1')

# return: score = 0.288

Dear @Jaeger416 ,
Could you please give some details about your environment?
When I try to run the code that you mentioned:
score = hpsv2.score('path/to/assests/demo_image.jpg' , 'cat with horn', hps_version='v2.1')
I get an error:
FileNotFoundError: [Errno 2] No such file or directory: '<python_environment_path>/lib/python3.10/site-packages/hpsv2/src/open_clip/bpe_simple_vocab_16e6.txt.gz'
I installed the HPS by:
pip install hpsv2
on newly created python3.10 virtual environment.

Hi @Jaeger416,

I can reproduce the same error of
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/dist-packages/hpsv2/src/open_clip/bpe_simple_vocab_16e6.txt.gz' from a clean python 3 environment created in Google Colaboratory.
See here for the notebook

I search this file on Github and find this https://github.com/facebookresearch/mmf/blob/f704bc5b2e71d0ca3e602d9baa6252c5188aa7d0/mmf/common/constants.py#L30
I have tried wget https://dl.fbaipublicfiles.com/mmf/clip/bpe_simple_vocab_16e6.txt.gz and move it to the specified path. It perhaps works well.

Hi @Jaeger416,

I can reproduce the same error of FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/dist-packages/hpsv2/src/open_clip/bpe_simple_vocab_16e6.txt.gz' from a clean python 3 environment created in Google Colaboratory. See here for the notebook

Here is the PR to fix the error: #38
I have published a fixed build named hpsv2x, check it out: https://pypi.org/project/hpsv2x/1.2.0/