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

Method setup_dictionary

fairseq/tasks/language_modeling.py:136–149  ·  view source on GitHub ↗
(cls, args, **kwargs)

Source from the content-addressed store, hash-verified

134
135 @classmethod
136 def setup_dictionary(cls, args, **kwargs):
137 dictionary = None
138 output_dictionary = None
139 if args.data:
140 paths = utils.split_paths(args.data)
141 assert len(paths) > 0
142 dictionary = Dictionary.load(os.path.join(paths[0], "dict.txt"))
143 logger.info("dictionary: {} types".format(len(dictionary)))
144 output_dictionary = dictionary
145 if args.output_dictionary_size >= 0:
146 output_dictionary = TruncatedDictionary(
147 dictionary, args.output_dictionary_size
148 )
149 return (dictionary, output_dictionary)
150
151 @classmethod
152 def setup_task(cls, args, **kwargs):

Callers 1

setup_taskMethod · 0.80

Calls 2

TruncatedDictionaryClass · 0.90
loadMethod · 0.45

Tested by

no test coverage detected