[Python] Repo id error when using hugging face transformers

Discussão em 'Python' iniciado por Stack, Setembro 6, 2025.

  1. Stack

    Stack Membro Participativo

    I keep getting this error when I try to use hugging face transformers library.

    huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': 'C:/Users/FZH91R/PycharmProjects/DudeWheresMyHealing/Pytorch/tf_model.h5'. Use `repo_type` argument if needed.


    Here is my code:

    CODE_DIR = os.path.dirname(__file__)
    ROOT_DIR = os.path.dirname(CODE_DIR)
    MODEL_DIR = os.path.join(ROOT_DIR, "Pytorch")
    CONFIG_DIR = os.path.join(ROOT_DIR, "Pytorch")

    # Load the model to be used.
    path_model = MODEL_DIR + "\tf_model.h5"
    print(path_model)
    path_config = CONFIG_DIR + "\config.json"
    print(path_config)

    # Load model from a local source.
    tokenizer = AutoTokenizer.from_pretrained(path_model, local_files_only=True)
    model = AutoModel.from_pretrained(path_model, config=path_config, local_files_only=True)


    My versions:

    transformers-4.31.0

    How can I fix this error?

    Continue reading...

Compartilhe esta Página