facechain icon indicating copy to clipboard operation
facechain copied to clipboard

AttributeError: Can't pickle local object 'patch_tqdm.<locals>.tqdm_swl'

Open 3wWqj opened this issue 2 years ago • 4 comments

windows-10 AMD Ryzen 7 3700X 8-Core Processor 3.60 GHz v1.6.0   python: 3.10.11   torch: 2.1.0+cu121   xformers: 0.0.22.post7 gradio: 3.41.2 G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\accelerate\accelerator.py:371: UserWarning: log_with=tensorboard was passed but no supported trackers are currently installed. warnings.warn(f"log_with={log_with} was passed but no supported trackers are currently installed.") 12/03/2023 23:44:36 - INFO - main - Distributed environment: NO Num processes: 1 Process index: 0 Local process index: 0 Device: cuda

Mixed precision type: no

2023-12-03 23:44:37,738 - modelscope - INFO - Use user-specified model revision: v2.0 {'thresholding', 'clip_sample_range', 'dynamic_thresholding_ratio', 'sample_max_value', 'variance_type'} was not found in config. Values will be initialized to default values. {'force_upcast'} was not found in config. Values will be initialized to default values. {'attention_type', 'reverse_transformer_layers_per_block', 'dropout'} was not found in config. Values will be initialized to default values. Downloading and preparing dataset imagefolder/person15_labeled to G:/ai/sd-webui-aki-v4.4/.cache/huggingface/datasets/imagefolder/person15_labeled-31349b5f4efad59a/0.0.0/37fbb85cc714a338bea574ac6c7d0b5be5aff46c1862c1989b20e0771199e93f... G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\utils\experimental.py:36: UserWarning: 'parallel_map' is experimental and might be subject to breaking changes in the future. warnings.warn( Traceback (most recent call last): File "G:\ai\sd-webui-aki-v4.4\extensions\facechain\facechain\train_text_to_image_lora.py", line 1222, in main() File "G:\ai\sd-webui-aki-v4.4\extensions\facechain\facechain\train_text_to_image_lora.py", line 791, in main dataset = load_dataset( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\load.py", line 1797, in load_dataset builder_instance.download_and_prepare( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\builder.py", line 909, in download_and_prepare self._download_and_prepare( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\builder.py", line 1670, in _download_and_prepare super()._download_and_prepare( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\builder.py", line 982, in _download_and_prepare split_generators = self._split_generators(dl_manager, **split_generators_kwargs) File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\packaged_modules\folder_based_builder\folder_based_builder.py", line 114, in _split_generators downloaded_files = dl_manager.download(files) File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\download\download_manager.py", line 427, in download downloaded_path_or_paths = map_nested( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\utils\py_utils.py", line 449, in map_nested mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested) File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\utils\experimental.py", line 40, in _inner_fn return fn(*args, **kwargs) File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\parallel\parallel.py", line 34, in parallel_map return _map_with_multiprocessing_pool( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\datasets\parallel\parallel.py", line 64, in _map_with_multiprocessing_pool with Pool(num_proc, initargs=initargs, initializer=initializer) as pool: File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\context.py", line 119, in Pool return Pool(processes, initializer, initargs, maxtasksperchild, File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\pool.py", line 215, in init self._repopulate_pool() File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\pool.py", line 306, in _repopulate_pool return self._repopulate_pool_static(self._ctx, self.Process, File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\pool.py", line 329, in _repopulate_pool_static w.start() File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\context.py", line 336, in _Popen return Popen(process_obj) File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\popen_spawn_win32.py", line 93, in init reduction.dump(process_obj, to_child) File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) AttributeError: Can't pickle local object 'patch_tqdm..tqdm_swl' 提示:Python 运行时抛出了一个异常。请检查疑难解答页面。 Error executing the command: Command '['python', 'G:\ai\sd-webui-aki-v4.4\extensions\facechain/facechain/train_text_to_image_lora.py', '--pretrained_model_name_or_path=ly261666/cv_portrait_model', '--revision=v2.0', '--sub_path=film/film', '--output_dataset_name=G:\ai\sd-webui-aki-v4.4\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\person15', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=G:\ai\sd-webui-aki-v4.4\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\person15', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32', '--resume_from_checkpoint=fromfacecommon']' returned non-zero exit status 1. Traceback (most recent call last): File "G:\ai\sd-webui-aki-v4.4\extensions\facechain\app.py", line 147, in train_lora_fn subprocess.run(command, check=True) File "G:\ai\sd-webui-aki-v4.4\python\lib\subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['python', 'G:\ai\sd-webui-aki-v4.4\extensions\facechain/facechain/train_text_to_image_lora.py', '--pretrained_model_name_or_path=ly261666/cv_portrait_model', '--revision=v2.0', '--sub_path=film/film', '--output_dataset_name=G:\ai\sd-webui-aki-v4.4\extensions\facechain\worker_data\qw\training_data\ly261666/cv_portrait_model\person15', '--caption_column=text', '--resolution=512', '--random_flip', '--train_batch_size=1', '--num_train_epochs=200', '--checkpointing_steps=5000', '--learning_rate=1.5e-04', '--lr_scheduler=cosine', '--lr_warmup_steps=0', '--seed=42', '--output_dir=G:\ai\sd-webui-aki-v4.4\extensions\facechain\worker_data\qw\ly261666/cv_portrait_model\person15', '--lora_r=4', '--lora_alpha=32', '--lora_text_encoder_r=32', '--lora_text_encoder_alpha=32', '--resume_from_checkpoint=fromfacecommon']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "G:\ai\sd-webui-aki-v4.4\python\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(*args, **kwargs) File "G:\ai\sd-webui-aki-v4.4\extensions\facechain\app.py", line 801, in run train_lora_fn(base_model_path=base_model_path, File "G:\ai\sd-webui-aki-v4.4\extensions\facechain\app.py", line 150, in train_lora_fn raise gr.Error("训练失败 (Training failed)") gradio.exceptions.Error: '训练失败 (Training failed)' 2023-12-03 23:44:53,726 - modelscope - INFO - PyTorch version 2.1.0+cu121 Found. 2023-12-03 23:44:53,732 - modelscope - INFO - Loading ast index from G:\ai\sd-webui-aki-v4.4.cache\modelscope\hub\ast_indexer 2023-12-03 23:44:53,950 - modelscope - INFO - Loading done! Current index file version is 1.9.5, with md5 db1f854959901a0fe1e3af0847c781d2 and a total number of 945 components indexed Traceback (most recent call last): File "", line 1, in File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "G:\ai\sd-webui-aki-v4.4\python\lib\multiprocessing\spawn.py", line 126, in _main self = reduction.pickle.load(from_parent) EOFError: Ran out of input 提示:Python 运行时抛出了一个异常。请检查疑难解答页面。

3wWqj avatar Dec 03 '23 15:12 3wWqj

the same error,it appeared after a certain time update.

escalate007 avatar Dec 05 '23 01:12 escalate007

same error, solved by changing the disable_tqdm=True,#not is_progress_bar_enabled() of download() in datasets\download\download_manager.py file image

CCMKCCMK avatar Dec 07 '23 10:12 CCMKCCMK

same error, solved by changing the disable_tqdm=True,#not is_progress_bar_enabled() of download() in datasets\download\download_manager.py file image

Thanks,it works~

escalate007 avatar Dec 07 '23 14:12 escalate007

welcome!

CCMKCCMK avatar Dec 07 '23 14:12 CCMKCCMK

please try out the newest train-free, 10s inference version facechain-fact.

sunbaigui avatar Jun 04 '24 09:06 sunbaigui