Skip to content

Commit

Permalink
update vpl start_iters allowed_delta adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
leondgarse committed Apr 21, 2022
1 parent 8c32a57 commit 3354ec7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def buildin_models(
nn = keras.layers.Dense(emb_shape, use_bias=use_bias, kernel_initializer="glorot_normal", name="F_dense")(nn)

# `fix_gamma=True` in MXNet means `scale=False` in Keras
embedding = keras.layers.BatchNormalization(momentum=bn_momentum, epsilon=bn_epsilon, scale=scale, name="pre_embedding")(nn)
embedding = keras.layers.BatchNormalization(momentum=bn_momentum, epsilon=bn_epsilon, scale=scale, dtype="float32", name="pre_embedding")(nn)
embedding_fp32 = keras.layers.Activation("linear", dtype="float32", name="embedding")(embedding)

basic_model = keras.models.Model(inputs, embedding_fp32, name=xx.name)
Expand Down Expand Up @@ -230,7 +230,7 @@ class NormDenseVPL(NormDense):
def __init__(self, batch_size, units=1000, vpl_lambda=0.15, kernel_regularizer=None, append_norm=False, **kwargs):
super().__init__(units, kernel_regularizer, append_norm=append_norm, **kwargs)
self.vpl_lambda, self.batch_size = vpl_lambda, batch_size # Need the actual batch_size here, for storing inputs
self.start_iters, self.allowed_delta = 8000 * batch_size // 512, 200 * batch_size // 512 # adjust according to batch_size
self.start_iters, self.allowed_delta = 8000 * 128 // batch_size, 200 * 128 // batch_size # adjust according to batch_size

def build(self, input_shape):
# self.queue_features in same shape format as self.norm_features, for easier calling tf.tensor_scatter_nd_update
Expand Down

1 comment on commit 3354ec7

@leondgarse
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #88

Please sign in to comment.