Imagine that I have model (tf.keras.Model):

```
class ContextExtractor(tf.keras.Model):
def __init__(self):
super().__init__()
self.model = self.__get_model()
def call(self, x, training=False, **kwargs):
features = self.model(x, training=training)
return features
def __get_model(self):
return self.__get_small_conv()
def __get_small_conv(self):
model = tf.keras.Sequential()
model.add(layers.Conv2D(32, (3, 3), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU(alpha=0.2))
model.add(layers.Conv2D(32, (3, 3), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU(alpha=0.2))
model.add(layers.Conv2D(64, (3, 3), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU(alpha=0.2))
model.add(layers.Conv2D(128, (3, 3), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU(alpha=0.2))
model.add(layers.Conv2D(256, (3, 3), strides=(2, 2), padding='same'))
model.add(layers.LeakyReLU(alpha=0.2))
model.add(layers.GlobalAveragePooling2D())
return model
```

I trained it and saved it using like:

```
checkpoint = tf.train.Checkpoint(
model=self.model,
global_step=tf.train.get_or_create_global_step())
checkpoint.save(weights_path / f'epoch_{epoch}')
```

It means that I have two saved files: `epoch_10-2.index`

and `epoch_10-2.data-00000-of-00001`

Now I want to deploy my model. I want to get .pb file. How can I get it? I suppose I need to open my model in graph mode, load my weights and save it in pb.file. How to do it in fact?

Thanks @BCJuan for information, I found solution.

Everyone who is looking for answer on my questions, please, look below.

NOTE: I suppose you've already saved model in

`checkpoint_dir`

and want to get this model in graph mode so that you may save it as`.pb`

file.