Skip to content

Commit

Permalink
move modeling.py and modeling_nv.py to transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
Li-Z-Q committed Dec 24, 2024
1 parent 226a298 commit bfc29f2
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 28 deletions.
2 changes: 2 additions & 0 deletions paddlenlp/transformers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,5 @@
from .jamba.modeling import *
from .jamba.configuration import *
from .jamba.tokenizer import *
from .llm_embed import *
from .nv_embed import *
4 changes: 3 additions & 1 deletion paddlenlp/transformers/llm_embed/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2024 PaddlePaddle Authors. 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.
Expand All @@ -11,3 +11,5 @@
# 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 .modeling import *
13 changes: 4 additions & 9 deletions paddlenlp/transformers/llm_embed/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@
# limitations under the License.

from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple, Union, cast
from typing import Dict, List, Optional, Union

import numpy as np
import paddle
import paddle.distributed as dist
import paddle.nn as nn
from tqdm import tqdm

from paddlenlp.transformers import (
AutoConfig,
AutoModel,
AutoModelForCausalLM,
PretrainedModel,
)
from paddlenlp.transformers.model_outputs import ModelOutput
from paddlenlp.utils.log import logger
from ...utils.log import logger
from .. import AutoConfig, AutoModel, PretrainedModel
from ..model_outputs import ModelOutput


@dataclass
Expand Down
4 changes: 3 additions & 1 deletion paddlenlp/transformers/nv_embed/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2024 PaddlePaddle Authors. 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.
Expand All @@ -11,3 +11,5 @@
# 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 .modeling import *
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple, Union, cast
from typing import Dict, List, Optional, Tuple, Union

import numpy as np
import paddle
Expand All @@ -23,14 +23,9 @@
from einops import rearrange, repeat
from paddle.distributed.fleet.utils import recompute

from paddlenlp.transformers import (
AutoTokenizer,
MistralModel,
PretrainedConfig,
PretrainedModel,
)
from paddlenlp.transformers.model_outputs import BaseModelOutputWithPast, ModelOutput
from paddlenlp.utils.log import logger
from ...utils.log import logger
from .. import AutoTokenizer, MistralModel, PretrainedConfig, PretrainedModel
from ..model_outputs import BaseModelOutputWithPast, ModelOutput


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@

import argparse
import logging
import sys

import mteb
import paddle
from mteb import MTEB

from paddlenlp.peft import LoRAConfig, LoRAModel
from paddlenlp.transformers import AutoModel, AutoModelForCausalLM, AutoTokenizer
from paddlenlp.transformers.llm_embed.modeling import BiEncoderModel
from paddlenlp.transformers.nv_embed.modeling_nv import NVEncodeModel
from paddlenlp.transformers import AutoTokenizer, BiEncoderModel, NVEncodeModel


class MTEB_EvalModel:
Expand Down
4 changes: 1 addition & 3 deletions slm/pipelines/examples/contrastive_training/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

from paddlenlp.peft import LoRAConfig, LoRAModel
from paddlenlp.trainer import PdArgumentParser, Trainer, get_last_checkpoint, set_seed
from paddlenlp.transformers import AutoTokenizer
from paddlenlp.transformers.llm_embed.modeling import BiEncoderModel
from paddlenlp.transformers.nv_embed.modeling_nv import NVEncodeModel
from paddlenlp.transformers import AutoTokenizer, BiEncoderModel, NVEncodeModel
from paddlenlp.utils.log import logger


Expand Down

0 comments on commit bfc29f2

Please sign in to comment.