logo
Browse Source

Add init

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 3 years ago
parent
commit
d7722f2089
  1. 19
      __init__.py
  2. 3
      longformer.py

19
__init__.py

@ -0,0 +1,19 @@
# Copyright 2021 Zilliz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from .longformer import Longformer
def longformer(model_name: str):
return Longformer(model_name)

3
longformer.py

@ -1,5 +1,4 @@
import numpy import numpy
from typing import NamedTuple
import torch import torch
from transformers import LongformerTokenizer, LongformerModel from transformers import LongformerTokenizer, LongformerModel
import logging import logging
@ -14,7 +13,7 @@ log = logging.getLogger()
@register(output_schema=['vec']) @register(output_schema=['vec'])
class LongformerEmbedding(NNOperator):
class Longformer(NNOperator):
""" """
NLP embedding operator that uses the pretrained longformer model gathered by huggingface. NLP embedding operator that uses the pretrained longformer model gathered by huggingface.
The Longformer model was presented in Longformer: The Long-Document Transformer by Iz Beltagy, The Longformer model was presented in Longformer: The Long-Document Transformer by Iz Beltagy,

Loading…
Cancel
Save