Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(helper): fix gpuutil exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Oct 15, 2019
1 parent b6837b1 commit af7c885
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions gnes/encoder/image/inception.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def __init__(self, model_dir: str,
self.inception_size_y = 299

def post_init(self):
import os
os.environ['CUDA_VISIBLE_DEVICES'] = str(get_first_available_gpu())

import tensorflow as tf
from .inception_cores.inception_v4 import inception_v4
from .inception_cores.inception_utils import inception_arg_scope
import os
os.environ['CUDA_VISIBLE_DEVICES'] = str(get_first_available_gpu())
g = tf.Graph()
with g.as_default():
arg_scope = inception_arg_scope()
Expand Down
6 changes: 2 additions & 4 deletions gnes/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import logging
import os
import sys
import time
import threading
import time
from copy import copy
from functools import wraps
from itertools import islice
Expand Down Expand Up @@ -104,9 +104,7 @@ def get_first_available_gpu():
if r:
return r[0]
raise ValueError
except ImportError:
return -1
except ValueError:
except Exception:
return -1


Expand Down

0 comments on commit af7c885

Please sign in to comment.