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

Having issues with using v2.1 inference #30

Open
PHOENIXFURY007 opened this issue Feb 29, 2024 · 5 comments
Open

Having issues with using v2.1 inference #30

PHOENIXFURY007 opened this issue Feb 29, 2024 · 5 comments

Comments

@PHOENIXFURY007
Copy link

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

@Jaeger416
Copy link
Collaborator

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

@miodek
Copy link

miodek commented Mar 5, 2024

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.

@nailuenlai
Copy link

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

@caopulan
Copy link

caopulan commented Apr 4, 2024

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.

@callmewhy
Copy link

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/

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

6 participants