StyleCLIP icon indicating copy to clipboard operation
StyleCLIP copied to clipboard

Running inference on a CPU

Open AK391 opened this issue 4 years ago • 4 comments
trafficstars

is it possible to run on cpu for inference, specifically the gui shown in the youtube video

AK391 avatar Apr 03 '21 01:04 AK391

Dear AK391,

Thank you for your interest in our project. Currently, we load the pretrained model from Stylegan2 which is trained using GPU. We can not even do Gs.print_layers() without GPU. Maybe try our colab which utilizes google gpu.

We will release a pure pythorch version in the future, which may run properly with just CPU.

Best Wishes,

Zongze

betterze avatar Apr 03 '21 15:04 betterze

@betterze could anycost gan help with this https://github.com/mit-han-lab/anycost-gan

AK391 avatar Apr 05 '21 20:04 AK391

Dear AK391,

Thank you for your interest in our project. Currently, we load the pretrained model from Stylegan2 which is trained using GPU. We can not even do Gs.print_layers() without GPU. Maybe try our colab which utilizes google gpu.

We will release a pure pythorch version in the future, which may run properly with just CPU.

Best Wishes,

Zongze

Just a little question, why can not the tf-version code run on CPU?

Currently, we load the pretrained model from Stylegan2 which is trained using GPU.

I'm fresh in this field. Can't we load it using CPU and its memory?

elenacliu avatar May 04 '23 13:05 elenacliu

I change the tf.configProto to unuse GPU, but the code under global_directions runs into error, which says:

tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'FusedBiasAct' used by node G_synthesis_1/4x4/Conv/FusedBiasAct (defined at <string>:104) with these attrs: [T=DT_FLOAT, axis=1, grad=0, alpha=0, clamp=-1, act=1, gain=1]
Registered devices: [CPU, XLA_CPU, XLA_GPU]
Registered kernels:
  device='GPU'; T in [DT_HALF]
  device='GPU'; T in [DT_FLOAT]

         [[G_synthesis_1/4x4/Conv/FusedBiasAct]]

Errors may have originated from an input operation.
Input Source operations connected to node G_synthesis_1/4x4/Conv/FusedBiasAct:
 G_synthesis_1/4x4/Conv/mul_2 (defined at <string>:67)
 G_synthesis_1/4x4/Conv/Const (defined at ./global_directions/dnnlib/tflib/ops/fused_bias_act.py:115)
 G_synthesis_1/4x4/Conv/MatMul (defined at <string>:46)

A similar quesion: https://discuss.tensorflow.org/t/tensorflow-inference-on-cpu-after-training-model-on-gpu-with-amp-and-xla/12731

elenacliu avatar May 04 '23 14:05 elenacliu