Пример #1
0
 def build_model(cls, args, task):
     encoder = RobertaWrapper.build_model(args, task)
     model_dict = nn.ModuleDict()
     for task_name, sub_task in task.tasks.items():
         task_override_args = args.tasks[task_name]
         if 'arch' in task_override_args:
             model_dict[task_name] = ARCH_MODEL_REGISTRY[
                 task_override_args['arch']].build_model(sub_task.args,
                                                         sub_task,
                                                         encoder=encoder)
         else:
             model_dict[task_name] = encoder
     return cls(args, encoder, model_dict)
Пример #2
0
 def build_model(cls, args, task, encoder=None):
     if encoder is None:
         encoder = RobertaWrapper.build_model(args, task)
     return cls(args, encoder)
Пример #3
0
 def build_model(cls, args, task, encoder=None):
     if encoder is None:
         encoder = RobertaWrapper.build_model(args, task)
     n_entities = len(task.entity_dictionary)
     return cls(args, encoder, n_entities)
Пример #4
0
 def build_model(cls, args, task, encoder=None):
     if encoder is None:
         encoder = RobertaWrapper.build_model(args, task)
     triplet_model = triplet_dict[args.triplet_type](args)
     n_entities = len(task.entity_dictionary)
     return cls(args, encoder, triplet_model, n_entities)