stylegan2报错“undefined symbol: _ZN10tensorflow12OpDefBuilder6OutputESs”的解决方案

  • 系统环境

本机python与gcc环境如下

  • 问题描述

dnnlib: Running training.training_loop.training_loop() on localhost...
Streaming data using training.dataset.TFRecordDataset...
Dataset shape = [3, 512, 512]
Dynamic range = [0, 255]
Label size    = 0
2019-12-19 17:15:03.506648: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
Constructing networks...
Setting up TensorFlow plugin "fused_bias_act.cu": Preprocessing... Loading... Failed!
Traceback (most recent call last):
  File "run_training.py", line 194, in <module>
    main()
  File "run_training.py", line 189, in main
    run(**vars(args))
  File "run_training.py", line 122, in run
    dnnlib.submit_run(**kwargs)
  File "/data2/stylegan2/dnnlib/submission/submit.py", line 343, in submit_run
    return farm.submit(submit_config, host_run_dir)
  File "/data2/stylegan2/dnnlib/submission/internal/local.py", line 22, in submit
    return run_wrapper(submit_config)
  File "/data2/stylegan2/dnnlib/submission/submit.py", line 280, in run_wrapper
    run_func_obj(**submit_config.run_func_kwargs)
  File "/data2/stylegan2/training/training_loop.py", line 149, in training_loop
    G = tflib.Network('G', num_channels=training_set.shape[0], resolution=training_set.shape[1], label_size=training_set.label_size, **G_args)
  File "/data2/stylegan2/dnnlib/tflib/network.py", line 97, in __init__
    self._init_graph()
  File "/data2/stylegan2/dnnlib/tflib/network.py", line 154, in _init_graph
    out_expr = self._build_func(*self.input_templates, **build_kwargs)
  File "/data2//stylegan2/training/networks_stylegan2.py", line 186, in G_main
    components.synthesis = tflib.Network('G_synthesis', func_name=globals()[synthesis_func], **kwargs)
  File "/data2/stylegan2/dnnlib/tflib/network.py", line 97, in __init__
    self._init_graph()
  File "/data2/stylegan2/dnnlib/tflib/network.py", line 154, in _init_graph
    out_expr = self._build_func(*self.input_templates, **build_kwargs)
  File "/data2/stylegan2/training/networks_stylegan2.py", line 365, in G_synthesis_stylegan_revised
    x = layer(x, layer_idx=0, fmaps=nf(1), kernel=3)
  File "/data2/stylegan2/training/networks_stylegan2.py", line 350, in layer
    x = modulated_conv2d_layer(x, dlatents_in[:, layer_idx], fmaps=fmaps, kernel=kernel, up=up, resample_kernel=resample_kernel, fused_modconv=fused_modconv)
  File "/data2/stylegan2/training/networks_stylegan2.py", line 99, in modulated_conv2d_layer
    s = apply_bias_act(s, bias_var=mod_bias_var) + 1 # [BI] Add bias (initially 1).
  File "/data2/stylegan2/training/networks_stylegan2.py", line 68, in apply_bias_act
    return fused_bias_act(x, b=tf.cast(b, x.dtype), act=act, alpha=alpha, gain=gain)
  File "/data2/stylegan2/dnnlib/tflib/ops/fused_bias_act.py", line 68, in fused_bias_act
    return impl_dict[impl](x=x, b=b, axis=axis, act=act, alpha=alpha, gain=gain)
  File "/data2/stylegan2/dnnlib/tflib/ops/fused_bias_act.py", line 122, in _fused_bias_act_cuda
    cuda_kernel = _get_plugin().fused_bias_act
  File "/data2/stylegan2/dnnlib/tflib/ops/fused_bias_act.py", line 16, in _get_plugin
    return custom_ops.get_plugin(os.path.splitext(__file__)[0] + '.cu')
  File "/data2/stylegan2/dnnlib/tflib/custom_ops.py", line 156, in get_plugin
    plugin = tf.load_op_library(bin_file)
  File "/opt/conda/envs/lib/python3.7/site-packages/tensorflow/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /data2/stylegan2/dnnlib/tflib/_cudacache/fused_bias_act_2d3e0715d2c9295a97a8ac95e846af6a.so: undefined symbol: _ZN10tensorflow12OpDefBuilder6OutputESs

  • 解决方案

导致这个问题,主要是在生成so包过程中,主要是由gcc编译选项问题导致的,gcc版本大于 4,本身支持c11标准,则不需要选项-D_GLIBCXX_USE_CXX11_ABI = 0;打开custom_ops.py中127行--compiler-options \'-fPIC -D_GLIBCXX_USE_CXX11_ABI=0,改为--compiler-options \'-fPIC -D_GLIBCXX_USE_CXX11_ABI=1,即可如下图所示:

 

  • 参考地址:

  1. https://blog.csdn.net/HelloJinYe/article/details/103302362
  2. https://blog.csdn.net/zhe_csdn/article/details/90345511
  3. https://blog.csdn.net/u012435142/article/details/81811487

 

 

 

评论 8 您还未登录,请先 登录 后发表或查看评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页

打赏作者

zaf赵

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值