iperov / DeepFaceLab

DeepFaceLab is the leading software for creating deepfakes.
GNU General Public License v3.0
46.27k stars 10.38k forks source link

MemoryError: Unable to allocate 3.00 MiB for an array with shape (512, 512, 3) and data type float32 #5703

Open OtherNAP opened 12 months ago

OtherNAP commented 12 months ago

Translated into English

Afternoon. I encountered a problem when running the file "6) train SAEHD":

`Running trainer.

[new] No saved models found. Enter a name of a new model : new

Model first run.

Choose one or several GPU idxs (separated by comma).

[CPU] : CPU [0] : NVIDIA GeForce RTX 3050

[0] Which GPU indexes to choose? : 0

[0] Autobackup every N hour ( 0..24 ?:help ) : 0 [n] Write preview history ( y/n ?:help ) : n [0] Target iteration : 0 [n] Flip SRC faces randomly ( y/n ?:help ) : n [y] Flip DST faces randomly ( y/n ?:help ) : y [8] Batch_size ( ?:help ) : 8 [128] Resolution ( 64-640 ?:help ) : 128 [f] Face type ( h/mf/f/wf/head ?:help ) : f [liae-ud] AE architecture ( ?:help ) : liae-ud [256] AutoEncoder dimensions ( 32-1024 ?:help ) : 256 [64] Encoder dimensions ( 16-256 ?:help ) : 64 [64] Decoder dimensions ( 16-256 ?:help ) : 64 [22] Decoder mask dimensions ( 16-256 ?:help ) : 22 [n] Eyes and mouth priority ( y/n ?:help ) : n [n] Uniform yaw distribution of samples ( y/n ?:help ) : n [n] Blur out mask ( y/n ?:help ) : n [y] Place models and optimizer on GPU ( y/n ?:help ) : y [y] Use AdaBelief optimizer? ( y/n ?:help ) : y [n] Use learning rate dropout ( n/y/cpu ?:help ) : n [y] Enable random warp of samples ( y/n ?:help ) : y [0.0] Random hue/saturation/light intensity ( 0.0 .. 0.3 ?:help ) : 0.0 [0.0] GAN power ( 0.0 .. 5.0 ?:help ) : 0.0 [0.0] Face style power ( 0.0..100.0 ?:help ) : 0.0 [0.0] Background style power ( 0.0..100.0 ?:help ) : 0.0 [none] Color transfer for src faceset ( none/rct/lct/mkl/idt/sot ?:help ) : none [n] Enable gradient clipping ( y/n ?:help ) : n [n] Enable pretraining mode ( y/n ?:help ) : n Initializing models: 100%|###############################################################| 5/5 [00:01<00:00, 3.96it/s] Loaded 654 packed faces from D:\Other\program\DeepFaceLab\workspace\data_src\aligned Loaded 1619 packed faces from D:\Other\program\DeepFaceLab\workspace\data_dst\aligned Process Process-7: Traceback (most recent call last): File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\SampleGeneratorFace.py", line 134, in batch_func x, = SampleProcessor.process ([sample], self.sample_process_options, self.output_sample_types, self.debug, ct_sample=ct_sample) File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\SampleProcessor.py", line 56, in process sample_bgr = sample.load_bgr() File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\Sample.py", line 112, in load_bgr img = cv2_imread (self.filename, loader_func=self.read_raw_file).astype(np.float32) / 255.0 MemoryError: Unable to allocate 3.00 MiB for an array with shape (512, 512, 3) and data type float32

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "multiprocessing\process.py", line 258, in _bootstrap File "multiprocessing\process.py", line 93, in run File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\core\joblib\SubprocessGenerator.py", line 54, in process_func gen_data = next (self.generator_func) File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\SampleGeneratorFace.py", line 136, in batch_func raise Exception ("Exception occured in sample %s. Error: %s" % (sample.filename, traceback.format_exc() ) ) Exception: Exception occured in sample 00242_0.jpg. Error: Traceback (most recent call last): File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\SampleGeneratorFace.py", line 134, in batch_func x, = SampleProcessor.process ([sample], self.sample_process_options, self.output_sample_types, self.debug, ct_sample=ct_sample) File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\SampleProcessor.py", line 56, in process sample_bgr = sample.load_bgr() File "D:\Other\program\DeepFaceLab_internal\DeepFaceLab\samplelib\Sample.py", line 112, in load_bgr img = cv2_imread (self.filename, loader_func=self.read_raw_file).astype(np.float32) / 255.0 MemoryError: Unable to allocate 3.00 MiB for an array with shape (512, 512, 3) and data type float32`

I have already encountered various problems when running this file, but successfully solved them by looking at the solutions here. But this line "MemoryError: Unable to allocate 3.00 MiB for an array with shape (512, 512, 3) and data type float32" is very intrusive. I've seen some people writing solutions to this problem, but I didn't understand them. I don't know much about Python and I couldn't find a "DataLoader" file to change the 6-- line. I did everything with already attached (test) data when unpacking the program and everything according to the instructions (except this file) from the video https://www.youtube.com/watch?v=vra-xlZlgD4. I removed all processes from auto startup. I had only explorer and bat file open.

RAM: 16.0 GB (available: 15.8 GB) Program on drive "D:" 92.1 GB free out of 379 GB available Processor: 12th Gen Intel(R) Core(TM) Core(TM) i5-12400F 2.50 GHz Version: 21H2 Installation date: 23.02.2023 OS build: 19044.3086 Video card: NVIDIA GeForce RTX 3050

If you need more data I'm happy to provide it.