mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-20 12:20:53 +08:00
update
This commit is contained in:
@@ -20,7 +20,7 @@ def loss(labels, logits):
|
||||
|
||||
class CTRLGenerator():
|
||||
|
||||
def __init__(self, control_code="Writing Text: ", generate_num=64, temperature=0.5, topk=40):
|
||||
def __init__(self, control_code="Writing Text: ", generate_num=64, temperature=0.3, topk=40):
|
||||
|
||||
self.generate_num=generate_num
|
||||
model_dir = "generator/ctrl/training_utils/seqlen512_v1.ckpt/"
|
||||
|
||||
@@ -134,8 +134,10 @@ model = tf.keras.Model(inputs=tokens, outputs=logits)
|
||||
# the loss function is a simple categorical crossentropy between the logits and the labels
|
||||
def loss(labels, logits):
|
||||
loss = tf.keras.losses.sparse_categorical_crossentropy(labels, logits, from_logits=True)
|
||||
loss = tf.Print(loss, [loss])
|
||||
return loss
|
||||
sum = tf.math.reduce_sum(loss)
|
||||
print_op = tf.Print(sum, [sum])
|
||||
with tf.control_dependencies([print_op]):
|
||||
return loss
|
||||
|
||||
|
||||
# the optimizer is not used since this code only supports inference
|
||||
|
||||
Reference in New Issue
Block a user