[Python] ModuleNotFoundError: No module named 'huggingface_hub.utils' using Anaconda

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to execute the example code of the huggingface website:

    from transformers import GPTJTokenizer, TFGPTJModel
    import tensorflow as tf

    tokenizer = GPTJTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
    model = TFGPTJModel.from_pretrained("EleutherAI/gpt-j-6B")

    inputs = tokenizer("Hello, my dog is cute", return_tensors="tf")
    outputs = model(inputs)

    last_hidden_states = outputs.last_hidden_state


    I'm using anaconda and I installed the transformers package beforehand with conda install -c huggingface transformers as explained in the documentation. But I still get this error, when I'm trying to execute the code. Following error message pops up: ModuleNotFoundError: No module named 'huggingface_hub.utils'

    How to resolve this error?

    Continue reading...

Compartilhe esta Página