コード例 #1
0
    def model_provider():
        """Build the model."""
        args = get_args()

        print_rank_0('building classification model for {} ...'.format(
            args.task))

        return Classification(num_classes=num_classes, num_tokentypes=2)
コード例 #2
0
    def model_provider(pre_process=True, post_process=True):
        """Build the model."""
        args = get_args()

        print_rank_0('building classification model for {} ...'.format(
            args.task))
        model = Classification(num_classes=num_classes,
                               num_tokentypes=2,
                               pre_process=pre_process,
                               post_process=post_process)

        return model
コード例 #3
0
    def model_provider():
        """Build the model."""
        args = get_args()

        print_rank_0('building classification model for {} ...'.format(
            args.task))
        if mpu.get_pipeline_model_parallel_world_size() > 1:
            # Determine model based on position of stage in pipeline.
            if mpu.is_pipeline_first_stage():
                model = ClassificationFirstStage(num_classes=num_classes,
                                                 num_tokentypes=2)
            elif mpu.is_pipeline_last_stage():
                model = ClassificationLastStage(num_classes=num_classes,
                                                num_tokentypes=2)
            else:
                model = ClassificationIntermediateStage(
                    num_classes=num_classes, num_tokentypes=2)
        else:
            model = Classification(num_classes=num_classes, num_tokentypes=2)

        return model
コード例 #4
0
 def model_provider():
     return Classification(num_classes=num_classes, num_tokentypes=2)