Commit f0de0b50 authored by Tao Xu's avatar Tao Xu Committed by Facebook GitHub Bot
Browse files

fix a bug which breaks the GAN training

Summary:
The GAN training pipeline is broken since last week, with the TypeError: cannot pickle
'_io.TextIOWrapper' object (refer to f283777469 for more details)

The issue is caused by D29379832 (https://github.com/facebookresearch/d2go/commit/5509a1383c1162081e9784d79eaf0b12ebbca1fd), in which the deepcopy is failed. This diff fixes this issue by disabling the FLOPs calculation when the deepcopy is failed.

Reviewed By: ppwwyyxx

Differential Revision: D29552182

fbshipit-source-id: 80d078b3d8ca68535e0366a412668e098b04ed04
parent d0c38c43
......@@ -33,7 +33,13 @@ def dump_flops_info(model, inputs, output_dir, use_eval_mode=True):
if not comm.is_main_process():
return
logger.info("Evaluating model's number of parameters and FLOPS")
try:
model = copy.deepcopy(model)
except Exception:
logger.info("Failed to deepcopy the model and skip FlopsEstimation.")
return
if use_eval_mode:
model.eval()
inputs = copy.deepcopy(inputs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment