mirror of
https://github.com/s0md3v/roop.git
synced 2025-12-07 10:28:28 +00:00
Limit tensorflow usage to 1GB VRAM
This commit is contained in:
parent
b7cf5df2f3
commit
d46fd55b91
@ -129,7 +129,9 @@ def limit_resources() -> None:
|
||||
# prevent tensorflow memory leak
|
||||
gpus = tensorflow.config.experimental.list_physical_devices('GPU')
|
||||
for gpu in gpus:
|
||||
tensorflow.config.experimental.set_memory_growth(gpu, True)
|
||||
tensorflow.config.experimental.set_virtual_device_configuration(gpu, [
|
||||
tensorflow.config.experimental.VirtualDeviceConfiguration(memory_limit=1024)
|
||||
])
|
||||
# limit memory usage
|
||||
if roop.globals.max_memory:
|
||||
memory = roop.globals.max_memory * 1024 ** 3
|
||||
|
||||
Loading…
Reference in New Issue
Block a user