utkd / gans

Various GANs for playing around
35 stars 23 forks source link

Unable to create a Session #3

Closed gexty444 closed 6 years ago

gexty444 commented 6 years ago

Hello, when I try to run the codes to create the GAN model, I receive an error saying that I am unable to create a Session. Appreciate any help :)


InternalError Traceback (most recent call last)

in () 3 disc_condition_input = Input(shape=(10,)) 4 ----> 5 discriminator, disc_out = get_discriminator(img_input, disc_condition_input) 6 discriminator.compile(optimizer=Adam(0.0002, 0.5), loss='binary_crossentropy', metrics=['accuracy']) 7 in get_discriminator(input_layer, condition_layer) 1 def get_discriminator(input_layer, condition_layer): 2 hid = Conv2D(128, kernel_size=3, strides=1, padding='same')(input_layer) ----> 3 hid = BatchNormalization(momentum=0.9)(hid) 4 hid = LeakyReLU(alpha=0.1)(hid) 5 ~/.virtualenvs/jlenv/lib/python3.5/site-packages/keras/engine/base_layer.py in __call__(self, inputs, **kwargs) 458 # Actually call the layer, 459 # collecting output(s), mask(s), and shape(s). --> 460 output = self.call(inputs, **kwargs) 461 output_mask = self.compute_mask(inputs, previous_mask) 462 ~/.virtualenvs/jlenv/lib/python3.5/site-packages/keras/layers/normalization.py in call(self, inputs, training) 181 normed_training, mean, variance = K.normalize_batch_in_training( 182 inputs, self.gamma, self.beta, reduction_axes, --> 183 epsilon=self.epsilon) 184 185 if K.backend() != 'cntk': ~/.virtualenvs/jlenv/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in normalize_batch_in_training(x, gamma, beta, reduction_axes, epsilon) 1833 """ 1834 if ndim(x) == 4 and list(reduction_axes) in [[0, 1, 2], [0, 2, 3]]: -> 1835 if not _has_nchw_support() and list(reduction_axes) == [0, 2, 3]: 1836 return _broadcast_normalize_batch_in_training(x, gamma, beta, 1837 reduction_axes, ~/.virtualenvs/jlenv/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in _has_nchw_support() 287 """ 288 explicitly_on_cpu = _is_current_explicit_device('CPU') --> 289 gpus_available = len(_get_available_gpus()) > 0 290 return (not explicitly_on_cpu and gpus_available) 291 ~/.virtualenvs/jlenv/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in _get_available_gpus() 273 global _LOCAL_DEVICES 274 if _LOCAL_DEVICES is None: --> 275 _LOCAL_DEVICES = get_session().list_devices() 276 return [x.name for x in _LOCAL_DEVICES if x.device_type == 'GPU'] 277 ~/.virtualenvs/jlenv/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py in get_session() 181 config = tf.ConfigProto(intra_op_parallelism_threads=num_thread, 182 allow_soft_placement=True) --> 183 _SESSION = tf.Session(config=config) 184 session = _SESSION 185 if not _MANUAL_VAR_INIT: /usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py in __init__(self, target, graph, config) 1561 1562 """ -> 1563 super(Session, self).__init__(target, graph, config=config) 1564 # NOTE(mrry): Create these on first `__enter__` to avoid a reference cycle. 1565 self._default_graph_context_manager = None /usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py in __init__(self, target, graph, config) 631 if self._created_with_new_api: 632 # pylint: disable=protected-access --> 633 self._session = tf_session.TF_NewSession(self._graph._c_graph, opts) 634 # pylint: enable=protected-access 635 else: InternalError: Failed to create session.
gexty444 commented 6 years ago

Solved. There was something wrong with the server I was using. :)