Repository: huggingface/diffusers

Issue:
huggingface_hub.utils._validators.HFValidationError: Repo id must use alphanumeric chars
### Describe the bug

I loaded the stable diffusion XL 1.0 model on my disk and followed instructions from
https://huggingface.co/docs/diffusers/v0.8.0/en/using-diffusers/loading#loading-pipelines-locally

The code is simply load the pretrained model.

```
import torch
from diffusers import DiffusionPipeline
from diffusers import StableDiffusionPipeline

model_name =  "./sd-xl-base-1.0"

pipeline = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch.float16,use_safetensors=True, variant="fp16")
```

It works well when your PWD is at the same directory as  the python script ( python ./xx.py)

But HFValidationError complains when PWD is changed.

On success

```
$ cd sd-xl-1.0/ && python diff.py
Loading pipeline components...: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [00:01<00:00,  3.73it/s]
```

On failure
```
$ python sd-xl-1.0/diff.py 
Traceback (most recent call last):
  File "sd-xl-1.0/diff.py", line 11, in <module>
    pipeline = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch.float16,use_safetensors=True, variant="fp16")
  File "/home/tonghengwen/anaconda3/envs/pytorch/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py", line 939, in from_pretrained
    cached_folder = cls.download(
  File "/home/tonghengwen/anaconda3/envs/pytorch/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py", line 1441, in download
    info = model_info(
  File "/home/tonghengwen/anaconda3/envs/pytorch/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 112, in _inner_fn
    validate_repo_id(arg_value)
  File "/home/tonghengwen/anaconda3/envs/pytorch/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 166, in validate_repo_id
    raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: './sd-xl-base-1.0'.
```


### Reproduction

```
import torch
from diffusers import DiffusionPipeline
from diffusers import StableDiffusionPipeline

model_name =  "./sd-xl-base-1.0"

pipeline = DiffusionPipeline.from_pretrained(model_name, torch_dtype=torch.float16,use_safetensors=True, variant="fp16")
```

Test above code from diffrent location

### Logs

_No response_

### System Info

diffusers-0.21.2
python3.8
Ubuntu 20

### Who can help?

 @patrickvonplaten @sayakpaul


Discussion:
In that case, you need to use absolute path. 
sorry, I forgot to mention that absolute path is not accepted either @sayakpaul 

And there isn't any description about the argument `repo_type` in the [doc](https://huggingface.co/docs/diffusers/v0.21.0/en/api/pipelines/overview#diffusers.DiffusionPipeline.from_pretrained)

```
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/tonghengwen/code/pytorch-test/xla_playground/pytorch/sd-xl-base-1.0'. Use `repo_type` argument if needed.
```
Could you please provide a reproducible Colab Notebook please? 
Hi @sayakpaul ,

I tried to reproduce the bug in colab but found the absolute path works just fine.
https://colab.research.google.com/drive/1jAwtC2-uAgc6bAmcSNcmvnZ7j-EIn6Sy?usp=sharing

The I figured out there's bug in my local code and after that everything just works great.

Thanks for the reply!

BTW, maybe add some hint in the document or the error message about the absolute path usage could be helpful.
Cool. Thanks. Feel free to open a PR then. I am closing the issue then since you've figured it out :) 
A better error message/warning is indeed a good idea here
I filed a PR to update the error message.
https://github.com/huggingface/huggingface_hub/pull/1683

This is a quick fix for current issue. A few explanations.

```
    if repo_id.count("/") > 1:
        raise HFValidationError(
            "Repo id must be in the form 'repo_name', 'namespace/repo_name' or '/path/to/repo' :"
            f" '{repo_id}'."
        )
```

`if repo_id.count("/") > 1:` and `'/path/to/repo' ` may look confusing.

The problem is when user provides a invalid /path/to/local/repo, eg, typo, the os.path.isdir will fail and pipeline_utils will assume user is providing a repo_id which should contains less than 1 '/'

Resolving patch:
diff --git a/src/diffusers/pipelines/pipeline_utils.py b/src/diffusers/pipelines/pipeline_utils.py
--- a/src/diffusers/pipelines/pipeline_utils.py
+++ b/src/diffusers/pipelines/pipeline_utils.py
@@ -1033,6 +1033,10 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
         # 1. Download the checkpoints and configs
         # use snapshot download here to get it working from from_pretrained
         if not os.path.isdir(pretrained_model_name_or_path):
+            if pretrained_model_name_or_path.count("/") > 1: 
+                raise ValueError(                                                                                                                                                                                                          
+                   f"The provided pretrained_model_name_or_path \"{pretrained_model_name_or_path}\""
+                   " is neither a valid local path nor a valid repo id. Please check the parameter.")
             cached_folder = cls.download(
                 pretrained_model_name_or_path,
                 cache_dir=cache_dir,


Test patch: