Failed to upload the model


#1

When i try to upload my custom keras model with weights ,it throws an error :failed to upload the model


#2

@rverma29 is your model compatible with Keras 1.2.2 ? Did you try without uploading the weights ?

If you can share your model file, we can check it on our end.


#3

Yes it is . Without weights it gets uploaded but then i’m not able to use that model with your input/output layers .
How can i share the model file with you?


#4

You can either copy/paste the YAML file here or send us email via support.


#5

backend: tensorflow
class_name: Sequential
config:

  • class_name: Model
    config:
    input_layers:
    • [input_1, 0, 0]
      layers:
    • class_name: InputLayer
      config:
      batch_input_shape: !!python/tuple [null, 224, 224, 3]
      dtype: float32
      name: input_1
      sparse: false
      inbound_nodes: []
      name: input_1
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: &id001 !!python/tuple [1, 1]
      filters: 64
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block1_conv1
      padding: same
      strides: &id002 !!python/tuple [1, 1]
      trainable: false
      use_bias: true
      inbound_nodes:
          • input_1
          • 0
          • 0
          • {}
            name: block1_conv1
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 64
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block1_conv2
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block1_conv1
          • 0
          • 0
          • {}
            name: block1_conv2
    • class_name: MaxPooling2D
      config:
      data_format: channels_last
      name: block1_pool
      padding: valid
      pool_size: !!python/tuple [2, 2]
      strides: !!python/tuple [2, 2]
      trainable: false
      inbound_nodes:
          • block1_conv2
          • 0
          • 0
          • {}
            name: block1_pool
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 128
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block2_conv1
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block1_pool
          • 0
          • 0
          • {}
            name: block2_conv1
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 128
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block2_conv2
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block2_conv1
          • 0
          • 0
          • {}
            name: block2_conv2
    • class_name: MaxPooling2D
      config:
      data_format: channels_last
      name: block2_pool
      padding: valid
      pool_size: !!python/tuple [2, 2]
      strides: !!python/tuple [2, 2]
      trainable: false
      inbound_nodes:
          • block2_conv2
          • 0
          • 0
          • {}
            name: block2_pool
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 256
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block3_conv1
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block2_pool
          • 0
          • 0
          • {}
            name: block3_conv1
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 256
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block3_conv2
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block3_conv1
          • 0
          • 0
          • {}
            name: block3_conv2
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 256
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block3_conv3
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block3_conv2
          • 0
          • 0
          • {}
            name: block3_conv3
    • class_name: MaxPooling2D
      config:
      data_format: channels_last
      name: block3_pool
      padding: valid
      pool_size: !!python/tuple [2, 2]
      strides: !!python/tuple [2, 2]
      trainable: false
      inbound_nodes:
          • block3_conv3
          • 0
          • 0
          • {}
            name: block3_pool
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 512
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block4_conv1
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block3_pool
          • 0
          • 0
          • {}
            name: block4_conv1
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 512
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block4_conv2
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block4_conv1
          • 0
          • 0
          • {}
            name: block4_conv2
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 512
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block4_conv3
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block4_conv2
          • 0
          • 0
          • {}
            name: block4_conv3
    • class_name: MaxPooling2D
      config:
      data_format: channels_last
      name: block4_pool
      padding: valid
      pool_size: !!python/tuple [2, 2]
      strides: !!python/tuple [2, 2]
      trainable: false
      inbound_nodes:
          • block4_conv3
          • 0
          • 0
          • {}
            name: block4_pool
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 512
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block5_conv1
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block4_pool
          • 0
          • 0
          • {}
            name: block5_conv1
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 512
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block5_conv2
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block5_conv1
          • 0
          • 0
          • {}
            name: block5_conv2
    • class_name: Conv2D
      config:
      activation: relu
      activity_regularizer: null
      bias_constraint: null
      bias_initializer:
      class_name: Zeros
      config: {}
      bias_regularizer: null
      data_format: channels_last
      dilation_rate: *id001
      filters: 512
      kernel_constraint: null
      kernel_initializer:
      class_name: VarianceScaling
      config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
      kernel_regularizer: null
      kernel_size: !!python/tuple [3, 3]
      name: block5_conv3
      padding: same
      strides: *id002
      trainable: false
      use_bias: true
      inbound_nodes:
          • block5_conv2
          • 0
          • 0
          • {}
            name: block5_conv3
    • class_name: MaxPooling2D
      config:
      data_format: channels_last
      name: block5_pool
      padding: valid
      pool_size: !!python/tuple [2, 2]
      strides: !!python/tuple [2, 2]
      trainable: false
      inbound_nodes:
          • block5_conv3
          • 0
          • 0
          • {}
            name: block5_pool
            name: vgg16
            output_layers:
    • [block5_pool, 0, 0]
  • class_name: Flatten
    config: {data_format: channels_last, name: flatten_1, trainable: true}
  • class_name: Dense
    config:
    activation: relu
    activity_regularizer: null
    bias_constraint: null
    bias_initializer:
    class_name: Zeros
    config: {}
    bias_regularizer: null
    kernel_constraint: null
    kernel_initializer:
    class_name: VarianceScaling
    config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
    kernel_regularizer: null
    name: dense_1
    trainable: true
    units: 1024
    use_bias: true
  • class_name: Dropout
    config: {name: dropout_1, noise_shape: null, rate: 0.4, seed: null, trainable: true}
  • class_name: Dense
    config:
    activation: relu
    activity_regularizer: null
    bias_constraint: null
    bias_initializer:
    class_name: Zeros
    config: {}
    bias_regularizer: null
    kernel_constraint: null
    kernel_initializer:
    class_name: VarianceScaling
    config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
    kernel_regularizer: null
    name: dense_2
    trainable: true
    units: 512
    use_bias: true
  • class_name: Dropout
    config: {name: dropout_2, noise_shape: null, rate: 0.5, seed: null, trainable: true}
  • class_name: Dense
    config:
    activation: softmax
    activity_regularizer: null
    bias_constraint: null
    bias_initializer:
    class_name: Zeros
    config: {}
    bias_regularizer: null
    kernel_constraint: null
    kernel_initializer:
    class_name: VarianceScaling
    config: {distribution: uniform, mode: fan_avg, scale: 1.0, seed: null}
    kernel_regularizer: null
    name: dense_3
    trainable: true
    units: 8
    use_bias: true
    keras_version: 2.1.6

#6

This model is generated using Keras 2.1.6 (as mentioned in the last line). Keras 2.1.6 models are not compatible with Keras 1.2.2.

You can try converting your code to Keras 1.2.2 format and then save the model from keras 1.2.2 environment. You should be able to load it after that.


#7

Hi,

I also tried importing a model created on keras 1.2.2. and had no luck. My yaml looks like this:

class_name: Model
config:
input_layers:

  • [input_1, 0, 0]
    layers:
  • class_name: InputLayer
    config:
    batch_input_shape: !!python/tuple [null, 32]
    input_dtype: float32
    name: input_1
    sparse: false
    inbound_nodes: []
    name: input_1
  • class_name: Dense
    config: {W_constraint: null, W_regularizer: null, activation: linear, activity_regularizer: null,
    b_constraint: null, b_regularizer: null, bias: true, init: glorot_uniform, input_dim: 32,
    name: dense_1, output_dim: 32, trainable: true}
    inbound_nodes:
      • [input_1, 0, 0]
        name: dense_1
        name: model_1
        output_layers:
  • [dense_1, 0, 0]
    keras_version: 1.2.2

It was generated with the following code:

from keras.optimizers import Adam
from keras.models import Model
from keras.layers import Input, Dense

a = Input(shape=(32,))
b = Dense(32)(a)
model = Model(input=a, output=b)
opt = Adam(lr=1e-3, decay=1e-3 / 20)
model.compile(loss=‘categorical_crossentropy’, optimizer=opt, metrics=[“accuracy”])

with open(‘model_test.yaml’, ‘w’) as f:
f.write(model.to_yaml())

Does anyone see why the import is failing?

Thanks


#8

The code and yaml file looks fine. How you are uploading it ?

Are you clicking on the + button (next to advance layers switch) and uploading this model ?


#9

That was the problem. I was trying to upload it clicking on the “Upload model” button (the one with an arrow pointing upwards)…could succesfully upload a model now, thanks!