advimman / lama

🦙 LaMa Image Inpainting, Resolution-robust Large Mask Inpainting with Fourier Convolutions, WACV 2022
https://advimman.github.io/lama-project/
Apache License 2.0
7.96k stars 844 forks source link

Fine tune the model on windows #153

Open FBehrad opened 2 years ago

FBehrad commented 2 years ago

To those who gonna train lama on windows, I recommend you to use Box instead of hydra not to face "Environment variable 'USER' not found"

First, write all of your configs in a single file, then add the following code to train.py:

def main():
    parent = '../configs/training'
    path = open(os.path.join(parent, 'big-lama.yaml'), 'r')
    conf = yaml.safe_load(path)
    config = Box(conf)
    try:

The config is now a box object which allows you to access its attributes by dot. For example: config.data.train.indir Also, you can use dict(config) to convert this box object to a dictionary.

Note: You need to debug the code to check configs and avoid any possible errors. This method helped me to run the code on windows successfully. I hope it works for you too :)

StrideZH commented 1 year ago

I tried running lama under windows in a conda environment with packages in requirements.txt , but got an error: [2022-10-26 21:08:40,258][__main__][CRITICAL] - Prediction failed due to invalid signal value: Traceback (most recent call last): File "D:/#01_lab/2-inpainting/lama-main/bin/predict.py", line 47, in main register_debug_signal_handlers() # kill -10 <pid> will result in traceback dumped into log File "D:\#01_lab\2-inpainting\lama-main\saicinpainting\utils.py", line 109, in register_debug_signal_handlers signal.signal(sig, handler) File "D:\software\package\anaconda3\envs\Gan\lib\signal.py", line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)) ValueError: invalid signal value

Do you know how to specifically improve the code to make it work on windows.