Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
This repository was archived by the owner on Aug 13, 2025. It is now read-only.

[BUG] Error loading 'lama' model: File not found on Windows with non-ASCII user path #663

@Leotheone

Description

@Leotheone

Model
lama

Describe the bug
The application fails to load the lama model and crashes on startup.

The console shows the following error: open file failed because of errno 2 on fopen: No such file or directory for the file path C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\big-lama.pt.

My Windows username is FrançoisGuias, which contains a non-ASCII character (ç). I believe the application is not correctly handling the Unicode path on Windows, which causes the file to not be found by the underlying JIT loader, even if it exists.

The expected behavior is for the model to load correctly, regardless of special characters in the user's home directory path.

Screenshots
Instead of a screenshot, here is the full console log which contains the complete error message and context.

Click to expand full console log
2025-07-22 11:25:17.871 | INFO     | iopaint.runtime:setup_model_dir:81 - Model directory: C:\Users\FrançoisGuias\.cache
- Platform: Windows-10-10.0.26100-SP0
- Python version: 3.10.6
- torch: 2.1.2+cu118
- torchvision: 0.16.2+cu118
- Pillow: 9.5.0
- diffusers: 0.27.2
- transformers: 4.48.3
- opencv-python: 4.11.0.86
- accelerate: 1.9.0
- iopaint: 1.6.0
- rembg: 2.0.67
- onnxruntime: 1.19.2

{
    "host": "127.0.0.1",
    "port": 8080,
    "inbrowser": true,
    "model": "lama",
    "no_half": false,
    "low_mem": false,
    "cpu_offload": false,
    "disable_nsfw_checker": false,
    "local_files_only": false,
    "cpu_textencoder": false,
    "device": "cuda",
    "input": null,
    "mask_dir": null,
    "output_dir": null,
    "quality": 95,
    "enable_interactive_seg": true,
    "interactive_seg_model": "sam2_1_tiny",
    "interactive_seg_device": "cuda",
    "enable_remove_bg": true,
    "remove_bg_device": "cuda",
    "remove_bg_model": "u2net_human_seg",
    "enable_anime_seg": false,
    "enable_realesrgan": true,
    "realesrgan_device": "cuda",
    "realesrgan_model": "realesr-general-x4v3",
    "enable_gfpgan": true,
    "gfpgan_device": "cuda",
    "enable_restoreformer": true,
    "restoreformer_device": "cuda"
}
2025-07-22 11:26:11.595 | INFO     | iopaint.plugins:build_plugins:33 - Initialize InteractiveSeg plugin
2025-07-22 11:26:11.601 | INFO     | iopaint.plugins.interactive_seg:_init_session:96 - SegmentAnything model path: C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\sam2.1_hiera_tiny.pt
2025-07-22 11:26:12.996 | INFO     | iopaint.plugins:build_plugins:39 - Initialize RemoveBG plugin
2025-07-22 11:26:17.937 | WARNING  | iopaint.plugins.remove_bg:device_warning:109 - remove_bg_device=cuda only supports briaai models(briaai/RMBG-1.4/briaai/RMBG-2.0)
2025-07-22 11:26:19.816 | INFO     | iopaint.plugins:build_plugins:47 - Initialize RealESRGAN plugin: realesr-general-x4v3, cuda
2025-07-22 11:26:19.831 | INFO     | iopaint.plugins.realesrgan:_init_model:438 - RealESRGAN model path: C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\realesr-general-x4v3.pth
2025-07-22 11:26:20.108 | INFO     | iopaint.plugins:build_plugins:57 - Initialize GFPGAN plugin
2025-07-22 11:26:20.113 | INFO     | iopaint.plugins:build_plugins:59 - Use realesrgan as GFPGAN background upscaler
2025-07-22 11:26:20.195 | INFO     | iopaint.plugins.gfpgan_plugin:__init__:21 - GFPGAN model path: C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\GFPGANv1.4.pth
2025-07-22 11:26:23.849 | INFO     | iopaint.plugins:build_plugins:70 - Initialize RestoreFormer plugin
2025-07-22 11:26:23.853 | INFO     | iopaint.plugins.restoreformer:__init__:21 - RestoreFormer model path: C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\RestoreFormer.pth
Working with z of shape (1, 256, 16, 16) = 65536 dimensions.
2025-07-22 11:26:26.954 | INFO     | iopaint.model_manager:init_model:47 - Loading model: lama
2025-07-22 11:26:26.959 | INFO     | iopaint.helper:load_jit_model:107 - Loading model from: C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\big-lama.pt
2025-07-22 11:26:28.734 | ERROR    | iopaint.helper:handle_error:94 - Failed to load model C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\big-lama.pt,please submit an issue at https://github.com/Sanster/lama-cleaner/issues and include a screenshot of the error:
open file failed because of errno 2 on fopen: No such file or directory, file path: C:\Users\FrançoisGuias\.cache\torch\hub\checkpoints\big-lama.pt

System Info

  • Platform: Windows-10-10.0.26100-SP0
  • Python: 3.10.6
  • iopaint: 1.6.0
  • pytorch: 2.1.2+cu118
  • CUDA: 11.8 (inferred from torch version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions