mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-05-02 15:24:30 +02:00
When reduced_memory is True, on crash only move model back to Cpu.
This commit is contained in:
parent
ae40b6ba8c
commit
d3df113fb0
@ -374,9 +374,17 @@ def mk_img(req: Request):
|
|||||||
yield from do_mk_img(req)
|
yield from do_mk_img(req)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
# Model crashed, release all resources in unknown state.
|
|
||||||
unload_models()
|
if thread_data.reduced_memory:
|
||||||
unload_filters()
|
thread_data.modelFS.to('cpu')
|
||||||
|
thread_data.modelCS.to('cpu')
|
||||||
|
thread_data.model.model1.to("cpu")
|
||||||
|
thread_data.model.model2.to("cpu")
|
||||||
|
else:
|
||||||
|
# Model crashed, release all resources in unknown state.
|
||||||
|
unload_models()
|
||||||
|
unload_filters()
|
||||||
|
|
||||||
gc() # Release from memory.
|
gc() # Release from memory.
|
||||||
yield json.dumps({
|
yield json.dumps({
|
||||||
"status": 'failed',
|
"status": 'failed',
|
||||||
|
Loading…
Reference in New Issue
Block a user