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

Method setup_task

fairseq/tasks/speech_to_text.py:55–68  ·  view source on GitHub ↗
(cls, args, **kwargs)

Source from the content-addressed store, hash-verified

53
54 @classmethod
55 def setup_task(cls, args, **kwargs):
56 data_cfg = S2TDataConfig(op.join(args.data, args.config_yaml))
57 dict_path = op.join(args.data, data_cfg.vocab_filename)
58 if not op.isfile(dict_path):
59 raise FileNotFoundError(f"Dict not found: {dict_path}")
60 tgt_dict = Dictionary.load(dict_path)
61 logger.info(
62 f"dictionary size ({data_cfg.vocab_filename}): " f"{len(tgt_dict):,}"
63 )
64
65 if getattr(args, "train_subset", None) is not None:
66 if not all(s.startswith("train") for s in args.train_subset.split(",")):
67 raise ValueError('Train splits should be named like "train*".')
68 return cls(args, tgt_dict)
69
70 def build_criterion(self, args):
71 from fairseq import criterions

Callers

nothing calls this directly

Calls 3

S2TDataConfigClass · 0.90
isfileMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected