# How do I access my models I saved inside a folder?

**URL:** <https://discuss.huggingface.co/t/how-do-i-access-my-models-i-saved-inside-a-folder/117478>\
**Category:** Beginners\
**Created:** [November 12, 2024, 10:16am UTC](https://discuss.huggingface.co/t/how-do-i-access-my-models-i-saved-inside-a-folder/117478 "2024-11-12T10:16:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sree-sphere](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@sree-sphere](https://discuss.huggingface.co/u/sree-sphere)\
**Post date:** [November 12, 2024, 10:16am UTC](https://discuss.huggingface.co/t/how-do-i-access-my-models-i-saved-inside-a-folder/117478/1 "2024-11-12T10:16:58Z")

</div>

I have fine tuned a model and saved it on my hugging-face inside a particular folder since I will save multiple folders having trained models for my use-case. I am able to access the path & print its contents using:

```auto
fs = HfFileSystem(token=hf_read)
file_find = fs.ls(folder_path, detail=True)

```

But how do I access the files for:  
model, tokenizer = FastLanguageModel.from\_pretrained(model\_name=model\_name,…)

Although I have used repo\_type=space (also tried saving & using from Model), my error:  
HFValidationError( huggingface\_hub.errors.HFValidationError: Repo id must be in the form ‘repo\_name’ or ‘namespace/repo\_name’: ‘//\<folder\_path\>’. Use repo\_type argument if needed.

Some variations I tried I got:  
Error loading model: \<folder\_path\>/\*.json (invalid repository id)

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [November 12, 2024, 12:36pm UTC](https://discuss.huggingface.co/t/how-do-i-access-my-models-i-saved-inside-a-folder/117478/2 "2024-11-12T12:36:22Z")

</div>

The functions related to HF models are designed on the premise that there is one model per repo, so they may not work properly.  
In the case of Diffusers, you may be able to use the subfolder option to get around this.

> <https://github.com/huggingface/diffusers/issues/8898>
>
> \### Describe the bug
> 
> Loading pretrained pipeline component such as UNET from …subfolder with path does not work.
> 
> Most of your examples use the subfolder formulation, for example \[here\](https://github.com/huggingface/diffusers/blob/main/examples/text\_to\_image/train\_text\_to\_image.py#L616) or \[here\](https://github.com/huggingface/diffusers/blob/main/examples/text\_to\_image/train\_text\_to\_image\_sdxl.py#L693) and it is supposed to work with a path.
> 
> \### Reproduction
> 
> Save "stabilityai/stable-diffusion-xl-base-1.0" locally on the computer in a "pretrained" folder for example and run 
> 
> \`\`\`python
> unet = UNet2DConditionModel.from\_pretrained(
> "pretrained", subfolder="unet",
> )
> \`\`\`
> 
> raises an error \`ValueError: pretrained is not a folder containing a \`.index.json\` file or a pytorch\_model.bin or a model.safetensors file\`
> 
> while it works with the remote formulation \`model repo + model id\` for hosted models.
> 
> A work around is to use 
> \`\`\`python
> unet = UNet2DConditionModel.from\_pretrained(
> "pretrained/unet",
> )
> \`\`\`
> 
> that works. If this is the only way to load component weights from directory path, that means all examples can't be run from local path and variable \`args.pretrained\_model\_name\_or\_path\` should be named \`args.pretrained\_model\_name\` only.
> 
> 
> \### Logs
> 
> \_No response\_
> 
> \### System Info
> 
> Python==3.10.14
> Conda env without accelerate
> torch==2.3.1
> Diffusers installed from source at commit a785992c1d6fcb1ff66f8a0d68d09a0a81b909e8 
> 
> 
> \### Who can help?
> 
> @DN6 @yiyixuxu @sayakpaul
