jiant/models.py
def build_single_sentence_module(task, d_inp: int, use_bert: bool, params: Params):
    """ Build a single sentence classifier

    args:
        - task (Task): task object, used to get the number of output classes
        - d_inp (int): input dimension to the module, needed for optional linear projection
        - use_bert (bool): if using BERT, skip projection before pooling.
        - params (Params): Params object with task-specific parameters

    returns:
        - SingleClassifier (nn.Module): single-sentence classifier consisting of
            (optional) a linear projection, pooling, and an MLP classifier
    """
    pooler = Pooler(
        project=not use_bert, 
        d_inp=d_inp, 
        d_proj=params["d_proj"], 
        pool_type=params["pool_type"]
    )
    d_out = d_inp if use_bert else params["d_proj"]
    classifier = Classifier.from_params(d_out, task.n_classes, params)
    log.info(f'Task {task.name} has a classifier with d_out {d_out}')
    module = SingleClassifier(pooler, classifier)
    return module
 Build a single sentence classifier

    args:
        - task (Task): task object, used to get the number of output classes
        - d_inp (int): input dimension to the module, needed for optional linear projection
        - use_bert (bool): if using BERT, skip projection before pooling.
        - params (Params): Params object with task-specific parameters

    returns:
        - SingleClassifier (nn.Module): single-sentence classifier consisting of
            (optional) a linear projection, pooling, and an MLP classifier
    
Build a single sentence classifier
args:
task (Task): task object, used to get the number of output classes
d_inp (int): input dimension to the module, needed for optional linear projection
use_bert (bool): if using BERT, skip projection before pooling.
params (Params): Params object with task-specific parameters

SingleClassifier (nn.Module): single-sentence classifier consisting of
(optional) a linear projection, pooling, and an MLP classifier
Build a single sentence classifier args : task ( Task ) : task object used to get the number of output classes d_inp ( int ) : input dimension to the module needed for optional linear projection use_bert ( bool ) : if using BERT skip projection before pooling . params ( Params ) : Params object with task - specific parameters SingleClassifier ( nn . Module ) : single - sentence classifier consisting of ( optional ) a linear projection pooling and an MLP classifier
def build_single_sentence_module(task, d_inp: int, use_bert: bool, params: Params):
    pooler = Pooler(
        project=not use_bert, 
        d_inp=d_inp, 
        d_proj=params["d_proj"], 
        pool_type=params["pool_type"]
    )
    d_out = d_inp if use_bert else params["d_proj"]
    classifier = Classifier.from_params(d_out, task.n_classes, params)
    log.info(f'Task {task.name} has a classifier with d_out {d_out}')
    module = SingleClassifier(pooler, classifier)
    return module
def build_single_sentence_module ( task , d_inp : int , use_bert : bool , params : Params ) : pooler = Pooler ( project = not use_bert , d_inp = d_inp , d_proj = params [ "d_proj" ] , pool_type = params [ "pool_type" ] ) d_out = d_inp if use_bert else params [ "d_proj" ] classifier = Classifier . from_params ( d_out , task . n_classes , params ) log . info ( f'Task {task.name} has a classifier with d_out {d_out}' ) module = SingleClassifier ( pooler , classifier ) return module
Build a single sentence classifier
args:
 task (Task): task object, used to get the number of output classes
 d_inp (int): input dimension to the module, needed for optional linear projection
 use_bert (bool): if using BERT, skip projection before pooling.
Build a single sentence classifier args : task ( Task ) : task object used to get the number of output classes d_inp ( int ) : input dimension to the module needed for optional linear projection use_bert ( bool ) : if using BERT skip projection before pooling .
""" Build a single sentence classifier

    args:
        - task (Task): task object, used to get the number of output classes
        - d_inp (int): input dimension to the module, needed for optional linear projection
        - use_bert (bool): if using BERT, skip projection before pooling.
        - params (Params): Params object with task-specific parameters

    returns:
        - SingleClassifier (nn.Module): single-sentence classifier consisting of
            (optional) a linear projection, pooling, and an MLP classifier
    """
task
d_inp
int
use_bert
bool
params
Params