Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when applying XSeg Mask. Help would be appreciated ASAP #883

Open
JacobWardCoding opened this issue Sep 4, 2020 · 5 comments
Open

Error when applying XSeg Mask. Help would be appreciated ASAP #883

JacobWardCoding opened this issue Sep 4, 2020 · 5 comments

Comments

@JacobWardCoding
Copy link

@JacobWardCoding JacobWardCoding commented Sep 4, 2020

Full terminal window & error message:

Applying trained XSeg model to aligned/ folder.
Traceback (most recent call last):
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 1334, in _do_call
return fn(*args)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 1317, in _run_fn
self._extend_graph()
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 1352, in _extend_graph
tf_session.ExtendSession(self._session)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation XSeg/conv01/conv/weight: {{node XSeg/conv01/conv/weight}}was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled.
[[{{node XSeg/conv01/conv/weight}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\main.py", line 324, in
arguments.func(arguments)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\main.py", line 285, in process_xsegapply
XSegUtil.apply_xseg (Path(arguments.input_dir), Path(arguments.model_dir))
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\mainscripts\XSegUtil.py", line 32, in apply_xseg
raise_on_no_model_files=True)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\facelib\XSegNet.py", line 68, in init
do_init = not model.load_weights( model_file_path )
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\layers\Saveable.py", line 96, in load_weights
nn.batch_set_value(tuples)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\ops_init_.py", line 29, in batch_set_value
nn.tf_sess.run(assign_ops, feed_dict=feed_dict)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 929, in run
run_metadata_ptr)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 1328, in _do_run
run_metadata)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\client\session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation XSeg/conv01/conv/weight: node XSeg/conv01/conv/weight (defined at C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\layers\Conv2D.py:76) was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled.
[[node XSeg/conv01/conv/weight (defined at C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\layers\Conv2D.py:76) ]]

Caused by op 'XSeg/conv01/conv/weight', defined at:
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\main.py", line 324, in
arguments.func(arguments)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\main.py", line 285, in process_xsegapply
XSegUtil.apply_xseg (Path(arguments.input_dir), Path(arguments.model_dir))
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\mainscripts\XSegUtil.py", line 32, in apply_xseg
raise_on_no_model_files=True)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\facelib\XSegNet.py", line 41, in init
self.model_weights = self.model.get_weights()
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\models\ModelBase.py", line 77, in get_weights
self.build()
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\models\ModelBase.py", line 65, in build
self._build_sub(v[name],name)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\models\ModelBase.py", line 35, in _build_sub
layer.build()
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\models\ModelBase.py", line 65, in build
self._build_sub(v[name],name)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\models\ModelBase.py", line 33, in _build_sub
layer.build_weights()
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\layers\Conv2D.py", line 76, in build_weights
self.weight = tf.get_variable("weight", (self.kernel_size,self.kernel_size,self.in_ch,self.out_ch), dtype=self.dtype, initializer=kernel_initializer, trainable=self.trainable )
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1479, in get_variable
aggregation=aggregation)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1220, in get_variable
aggregation=aggregation)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 547, in get_variable
aggregation=aggregation)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 499, in _true_getter
aggregation=aggregation)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 911, in _get_single_variable
aggregation=aggregation)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variables.py", line 213, in call
return cls._variable_v1_call(*args, **kwargs)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variables.py", line 176, in _variable_v1_call
aggregation=aggregation)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variables.py", line 155, in
previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2495, in default_variable_creator
expected_shape=expected_shape, import_scope=import_scope)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variables.py", line 217, in call
return super(VariableMetaclass, cls).call(*args, **kwargs)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variables.py", line 1395, in init
constraint=constraint)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\variables.py", line 1509, in _init_from_args
name=name)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\state_ops.py", line 79, in variable_op_v2
shared_name=shared_name)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 1424, in variable_v2
shared_name=shared_name, name=name)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\framework\ops.py", line 3300, in create_op
op_def=op_def)
File "C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\python-3.6.8\lib\site-packages\tensorflow\python\framework\ops.py", line 1801, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Cannot assign a device for operation XSeg/conv01/conv/weight: node XSeg/conv01/conv/weight (defined at C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\layers\Conv2D.py:76) was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device. The requested device appears to be a GPU, but CUDA is not enabled.
[[node XSeg/conv01/conv/weight (defined at C:\Users\Joshua Waghorn\Documents\DeepFaceLab_NVIDIA_internal\DeepFaceLab\core\leras\layers\Conv2D.py:76) ]]

Please send help ASAP. I really need to learn how to do a full head deepfake for my English Assessment. Thanks

@HotDenim
Copy link

@HotDenim HotDenim commented Sep 4, 2020

The requested device appears to be a GPU, but CUDA is not enabled.

Seems to indicate your Graphics Card is not NVidia Make. If it is not then Either use DeepFaceLab Version 1's AMD / OPENCL variant (if Graphics hardware is AMD) or use Version 2 in CPU mode (not recommended too slow, unusable).

It could also be your graphics hardware is not Nvidai or AMD or anything with OPENCL support.

Also try updating graphic hardware's drivers (install full CUDA/OpenCL support if it is an optional extra)

@JacobWardCoding
Copy link
Author

@JacobWardCoding JacobWardCoding commented Sep 4, 2020

Yeah, I don't have a graphics card, so I am using CPU only. Is it possible to work for me?

If not, could I simply move the files to a USB, and do it on a computer with a GPU? Then pass it back to mine?

EDIT: If not, is it possible to do a full head deep-fake without XSeg mask?

@HotDenim
Copy link

@HotDenim HotDenim commented Sep 5, 2020

To do it on a CPU, you will have to Convert DeepFaceLab Version 2.0, to CPU. There is an option to do this, by running one of the files.

But CPU is extremely slower, like 50 times. Make use of a GPU.

But most operations use a GPU, except the last step step where the generated frames are put back into a video file. This only takes a few minutes. So you will be using GPU for almost all of DeepFaceLab.

@jeromel1978
Copy link

@jeromel1978 jeromel1978 commented Nov 28, 2020

To do it on a CPU, you will have to Convert DeepFaceLab Version 2.0, to CPU. There is an option to do this, by running one of the files.

But CPU is extremely slower, like 50 times. Make use of a GPU.

But most operations use a GPU, except the last step step where the generated frames are put back into a video file. This only takes a few minutes. So you will be using GPU for almost all of DeepFaceLab.

I can confirm that the converting to CPU does NOT work with the XSEG trained mask applying and removal. I do understand that running training in CPU is slower... but should this part of the process still work without an Nvidia GPU like the others for XSEG?

@smclovek
Copy link

@smclovek smclovek commented Jan 6, 2021

Can I run XSeg mask applying on CPU by changing something in the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants