diff --git a/__init__.py b/__init__.py index e69de29..2832034 100644 --- a/__init__.py +++ b/__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) diff --git a/longformer.py b/longformer.py index 0d67981..3126249 100644 --- a/longformer.py +++ b/longformer.py @@ -1,5 +1,4 @@ import numpy -from typing import NamedTuple import torch from transformers import LongformerTokenizer, LongformerModel import logging @@ -14,7 +13,7 @@ log = logging.getLogger() @register(output_schema=['vec']) -class LongformerEmbedding(NNOperator): +class Longformer(NNOperator): """ 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,