Skip to content

Is it possible to use Modnet with gpu acceleration ? #226

@naik-aakash

Description

@naik-aakash

Hi @ml-evs , @ppdebreuck , I have been trying to use Modnet with GPU. But cannot get it to work. I had to use a different tensorflow version than pinned on modnet. I am using tensorflow==2.15.0. (As using 2.11.0, gpus are not detected at all on my system)

System has cuda 12.4 installed.

It always fails with the following error

"CUDA-capable device(s) is/are busy or unavailable" or failed to set cuda device.

I tested with this to see if the TensorFlow is installed correctly. It seems to be the case tensorflow is working fine.

import os
import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
tf.debugging.set_log_device_placement(True)
os.environ["CUDA_VISIBLE_DEVICES"] = "0"

with tf.device('/gpu:0'):
    a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
    b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
    c = tf.matmul(a, b)

with tf.Session() as sess:
    print (sess.run(c))

Not able to figure out what could be the problem here. Any help in this regard would be great!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions