Lightning-AI / litgpt

Pretrain, finetune, deploy 20+ LLMs on your own data. Uses state-of-the-art techniques: flash attention, FSDP, 4-bit, LoRA, and more.
https://lightning.ai
Apache License 2.0
6.95k stars 733 forks source link

PermissionError: [WinError 5] #1297

Open Magniveo opened 1 month ago

Magniveo commented 1 month ago

I have an error in Windows when running litgpt download --repo_id microsoft/phi-2 The error may be in os.remove(path)

Magniveo commented 1 month ago
try:
      os.remove(safetensor_path)
      print(f"Removed {safetensor_path}")
      os.rename(bin_path, safetensor_path)
      print(f"Renamed {bin_path} to {safetensor_path}")
except:
            continue
             pass
rasbt commented 1 month ago

Thanks for reporting! Unfortunately, I don't have a windows machine to test it, but we need to investigate ... Maybe @carmocca can help here as I think he has a non-mac computer.

carmocca commented 3 weeks ago

I use Linux. @Magniveo What's the error you get exactly? Are you able to reproduce the issue in a script that only runs those lines? Do you have proper permissions in that directory?

Magniveo commented 3 weeks ago

The error PermissionError: [WinError 5] persists, even after attempting to solve it with administrative privileges.

carmocca commented 3 weeks ago

Does

import shutil
shutil.rmtree(safetensor_path)

work?

Magniveo commented 3 weeks ago

Does

import shutil
shutil.rmtree(safetensor_path)

work?

Nope, there's another error File "C:\Python312\Lib\shutil.py", line 621, in _rmtree_unsafe with os.scandir(path) as scandir_it: NotADirectoryError: [WinError 267]

carmocca commented 3 weeks ago

My bad. I thought rmtree worked for files

rasbt commented 3 weeks ago

I use Linux.

Ah my bad, I thought you might have a dual boot or WSL setup. Now I know :)