MCPcopy Create free account
hub / github.com/RingBDStack/GDAP / __init__

Method __init__

seq2seq/constrained_seq2seq.py:84–105  ·  view source on GitHub ↗
(self, decoding_type_schema=None, decoding_format='tree', source_prefix=None, *args, **kwargs)

Source from the content-addressed store, hash-verified

82
83class ConstraintSeq2SeqTrainer(Seq2SeqTrainer):
84 def __init__(self, decoding_type_schema=None, decoding_format='tree', source_prefix=None, *args, **kwargs):
85 super().__init__(*args, **kwargs)
86
87 self.decoding_format = decoding_format
88 self.decoding_type_schema = decoding_type_schema # 在event任务中为 event schema
89
90 # Label smoothing by sum token loss, different from different Label smootheing
91 if self.args.label_smoothing_sum and self.args.label_smoothing_factor != 0:
92 self.label_smoother = SumLabelSmoother(epsilon=self.args.label_smoothing_factor)
93 print('Using %s' % self.label_smoother)
94 elif self.args.label_smoothing_factor != 0:
95 print('Using %s' % self.label_smoother)
96 else:
97 self.label_smoother = None
98
99 if self.args.constraint_decoding:
100 self.constraint_decoder = get_constraint_decoder(tokenizer=self.tokenizer,
101 type_schema=self.decoding_type_schema,
102 decoding_schema=self.decoding_format,
103 source_prefix=source_prefix)
104 else:
105 self.constraint_decoder = None
106
107 def prediction_step(
108 self,

Callers

nothing calls this directly

Calls 2

SumLabelSmootherClass · 0.90
get_constraint_decoderFunction · 0.90

Tested by

no test coverage detected