Iam Facing unhashable type dict isuue any resolution.

#2
by Neeraj13 - opened

Can't load tokenizer using from_pretrained, please update its configuration: unhashable type: 'dict'

You should build transformers with the latest version from github.

I got that error before as well. When you install using pip, you only get transformers 4.29. MMS needs transformers 4.3 which is only available when you install from source: pip install git+https://github.com/huggingface/transformers.git. The error went away for me after I did that.

vineelpratap changed discussion status to closed

Hello, I am on 4.31.0.dev0 of transformers yet I am still getting this error. What could be wrong?

Have you followed the instructions as per the docs? https://huggingface.co/docs/transformers/main/en/model_doc/mms#loading

@vineelpratap pushed some nice clarifications that should mean you don't hit this issue!

If you're still facing it, could you provide a reproducible codesnippet @Neeraj13 @bluman1 ?

sanchit-gandhi changed discussion status to open

Here's the snippet that produces the error:

import requests

API_URL = "https://api-inference.huggingface.co/models/facebook/mms-1b-all"
headers = {"Authorization": "Bearer HF_API_KEY"}


def query(filename):
    with open(filename, "rb") as f:
        data = f.read()
    response = requests.post(API_URL, headers=headers, data=data)
    return response.json()

output = query("audio/mms_sampling/MyNameYor.flac")  # local audio file
print(output)  # prints: {'error': "Can't load tokenizer using from_pretrained, please update its configuration: unhashable type: 'dict'"}

Hey @bluman1 , here is a way in which you can use MMS models - https://huggingface.co/spaces/mms-meta/MMS/blob/main/asr.py#L37

MMS models don't work using the above API (unlike other wav2ve2c based models) as they used adapter layers inside. cc. @patrickvonplaten

Sign up or log in to comment