def sentence_embedding(config=None):
    """
    Define pipeline
    """
    if config is None:
        config = SentenceSimilarityConfig()

    allow_triton, emb_op = _get_embedding_op(config)
    op_config = {}
    if allow_triton:
        if config.device >= 0:
            op_config = AutoConfig.TritonGPUConfig(device_ids=[config.device], max_batch_size=128)
        else:
            op_config = AutoConfig.TritonCPUConfig()
    p = (
        pipe.input('text')
        .map('text', 'vec', emb_op, config=op_config)
    )

    if config.normalize_vec:
        p = p.map('vec', 'vec', ops.towhee.np_normalize())
    return p.output('vec')
Define pipeline
towhee/pipelines/sentence_embedding.py