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

Translation: AttributeError: 'ModelInfo' object has no attribute 'modelId' #750

Closed
adieyal opened this issue Jul 22, 2024 · 5 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@adieyal
Copy link

adieyal commented Jul 22, 2024

Translation stopped working for me and I'm not sure what changed.

from txtai.pipeline import Translation

# Create and run pipeline
translate = Translation()
translate("This is a test translation into Spanish", "es")
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[17], line 4
      1 from txtai.pipeline import Translation
      3 # Create and run pipeline
----> 4 translate = Translation()
      5 translate("This is a test translation into Spanish", "es")

File ~/Development/notebooks/.venv/lib/python3.10/site-packages/txtai/pipeline/text/translation.py:54, in Translation.__init__(self, path, quantize, gpu, batch, langdetect, findmodels)
     52 # Language models
     53 self.models = {}
---> 54 self.ids = self.modelids()

File ~/Development/notebooks/.venv/lib/python3.10/site-packages/txtai/pipeline/text/translation.py:115, in Translation.modelids(self)
    107 def modelids(self):
    108     """
    109     Runs a query to get a list of available language models from the Hugging Face API.
    110 
    111     Returns:
    112         list of source-target language model ids
    113     """
--> 115     ids = [x.modelId for x in HfApi().list_models(author="Helsinki-NLP")] if self.findmodels else []
    116     return set(ids)

File ~/Development/notebooks/.venv/lib/python3.10/site-packages/txtai/pipeline/text/translation.py:115, in <listcomp>(.0)
    107 def modelids(self):
    108     """
    109     Runs a query to get a list of available language models from the Hugging Face API.
    110 
    111     Returns:
    112         list of source-target language model ids
    113     """
--> 115     ids = [x.modelId for x in HfApi().list_models(author="Helsinki-NLP")] if self.findmodels else []
    116     return set(ids)

AttributeError: 'ModelInfo' object has no attribute 'modelId'
> pip freeze | grep -e  huggingface -e txtai

huggingface-hub==0.24.0
txtai==7.3.0

It looks like the last version of huggingface-hub that used modelId was v0.18
It isn't available in v0.19 or later

@davidmezzetti
Copy link
Member

davidmezzetti commented Jul 22, 2024

Hugging Face must have changed something on the server side. Because this build just ran with huggingface-hub==0.24.0 yesterday and was fine.

https://github.com/neuml/txtai/actions/runs/10029750031/job/27718304694

@davidmezzetti
Copy link
Member

Update: It looks like this change is the root of this issue.

huggingface/huggingface_hub#2405

@adieyal
Copy link
Author

adieyal commented Jul 22, 2024

Good to know - I temporarily patched translation.py after i couldn't find a version of huggingface-hub that worked.

@davidmezzetti
Copy link
Member

It appears that whatever change happened was reverted upstream.

Nonetheless, I'll still plan to update the API call to use the latest. But at least it sounds like it's not an emergency.

@davidmezzetti davidmezzetti self-assigned this Jul 22, 2024
@davidmezzetti davidmezzetti added this to the v7.4.0 milestone Jul 22, 2024
@davidmezzetti davidmezzetti added the bug Something isn't working label Jul 22, 2024
@julien-c
Copy link

sorry about the breaking change on our side!

(we have reverted the change server side for now, but we plan to re-apply it in the future)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants