HFvalidationerror: Repo_id must be in the form repo_name

Dear all,

I am running into the following HFValidationError. Did my research and couldnt find a solution so far. Anyone with ideas?

Is there a problem with the server side, package incompatibility?

huggingface_hub,utils_validators.HFValidationError: Repo id must be in the form ‘repo_name’ or ‘namespace/repo_name’: Use ‘repo_type’ argument if needed.

Best Regards,
Mete.

2 Likes

I had this same error. my model is stored in a directory named all-MiniLM-L12-v2. It works great. I tried a new model and it had the same error. When I removed the folder called 1_Pooling which has one config.json file in it, the model loading gave the same error. Make sure in your model directory that there is a directory called 1_Pooling with the appropriate config.json file in it.
best regards,

4 Likes

Hello @mtsvnc ,

HF requires the repo id to reference a repository that is created on your HF profile. This can either be a dataset, space or simply just a repository. If it does not exist, you can either create it manually, or create the repo beforehand before invoking the call that is resulting in the HFValidationError. Reference the create_repo documentation.

These are the current create_repo arguments:

def create_repo(
        self,
        repo_id: str,
        *,
        token: Union[str, bool, None] = None,
        private: bool = False,
        repo_type: Optional[str] = None,
        exist_ok: bool = False,
        space_sdk: Optional[str] = None,
        space_hardware: Optional[SpaceHardware] = None,
        space_storage: Optional[SpaceStorage] = None,
        space_sleep_time: Optional[int] = None,
        space_secrets: Optional[List[Dict[str, str]]] = None,
        space_variables: Optional[List[Dict[str, str]]] = None,
    )

This allows flexibility on creating the repo by either creating it privately by specifying private=true, what type of repo it should be, and whether it should check if the repo exists and if it does not then do not create it by specifying exist_ok=True.

Once it is created, navigate to your HF profile and you will now be able to see the repo created. This is essentially a git repo that has version control.

It works for me, thx a lot!

I ran into the same error and had a lots troubles dealing with it. Why cannot make it more user-friendly

Not user friendly it really is…
I think it probably snorted as they added on to it.

I’m not sure of the details of your situation, but perhaps the error message is correct: the HF API and related programs assume models by default, so you often need to specify repo_type when dealing with non-models (datasets or spaces).

( repo_id: strfilename: strrepo_type: Optional[str] = Nonerevision: Optional[str] = Nonetoken: Union[str, bool, None] = None ) 

 repo_type (str, optional) — Set to "dataset" or "space" if getting repository info from a dataset or a space, None or "model" if getting repository info from a model. Default is None.