mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +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
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# coding: utf-8
|
||||
import re
|
||||
import yaml
|
||||
|
||||
@@ -104,6 +105,8 @@ def mapping_variation_pairs(mapping):
|
||||
|
||||
first_to_second_mappings = [
|
||||
("I'm", "you're"),
|
||||
("Im", "you're"),
|
||||
("Ive", "you've"),
|
||||
("I am", "you are"),
|
||||
("I", "you"),
|
||||
("I've", "you've"),
|
||||
|
||||
Reference in New Issue
Block a user