MCPcopy Create free account
hub / github.com/FLC777/GLAT / setup_task

Method setup_task

fairseq/tasks/language_modeling.py:152–175  ·  view source on GitHub ↗

Setup the task (e.g., load dictionaries). Args: args (argparse.Namespace): parsed command-line arguments

(cls, args, **kwargs)

Source from the content-addressed store, hash-verified

150
151 @classmethod
152 def setup_task(cls, args, **kwargs):
153 """Setup the task (e.g., load dictionaries).
154
155 Args:
156 args (argparse.Namespace): parsed command-line arguments
157 """
158 dictionary, output_dictionary = cls.setup_dictionary(args, **kwargs)
159
160 # upgrade old checkpoints
161 if getattr(args, "exclude_self_target", False):
162 args.self_target = False
163
164 targets = []
165 if getattr(args, "self_target", False):
166 targets.append("self")
167 if getattr(args, "future_target", False):
168 targets.append("future")
169 if getattr(args, "past_target", False):
170 targets.append("past")
171 if len(targets) == 0:
172 # standard language modeling
173 targets = ["future"]
174
175 return cls(args, dictionary, output_dictionary, targets=targets)
176
177 def build_model(self, args):
178 model = super().build_model(args)

Callers

nothing calls this directly

Calls 1

setup_dictionaryMethod · 0.80

Tested by

no test coverage detected