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,

1 Like

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!