Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

New method to set shape of model inputs #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions models_generation/distilbert.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
input_spec = tf.TensorSpec([1, 384], tf.int32)
model._set_inputs(input_spec, training=False)


# For tensorflow>2.2.0, set inputs in the following way.
# Otherwise, the model.inputs and model.outputs will be None.
# keras_input = tf.keras.Input([384], batch_size=1, dtype=tf.int32)
# keras_output = model(keras_input, training=False)
# model = tf.keras.Model(keras_input, keras_output)


print(model.inputs)
print(model.outputs)

Expand Down
6 changes: 6 additions & 0 deletions models_generation/gpt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
input_spec = tf.TensorSpec([1, 64], tf.int32)
model._set_inputs(input_spec, training=False)

# For tensorflow>2.2.0, set inputs in the following way.
# Otherwise, the model.inputs and model.outputs will be None.
# keras_input = tf.keras.Input([64], batch_size=1, dtype=tf.int32)
# keras_output = model(keras_input, training=False)
# model = tf.keras.Model(keras_input, keras_output)

print(model.inputs)
print(model.outputs)

Expand Down