Skip to content

Commit

Permalink
add depreciation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Nov 2, 2023
1 parent 0665e08 commit 6c4e2fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions optimum/onnxruntime/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"""Defines the base classes that are used to perform inference with ONNX Runtime of Transformers models."""

from abc import abstractmethod
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, Union
from typing import TYPE_CHECKING, Dict, Optional, Set, Tuple, Union

import numpy as np
import torch
from transformers.modeling_outputs import BaseModelOutput, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput
from transformers.modeling_outputs import BaseModelOutput, Seq2SeqLMOutput

from onnxruntime import InferenceSession

Expand Down Expand Up @@ -495,5 +495,9 @@ def prepare_inputs_for_merged(


class ORTDecoder(ORTDecoderForSeq2Seq):
# TODO : add warning message
pass

def __init__(self, *args, **kwargs):
logger.warning(
f"The class `ORTDecoder` is deprecated and will be removed in optimum v1.15.0, please use `ORTDecoderForSeq2Seq` instead."
)
super().__init__(*args, **kwargs)
2 changes: 1 addition & 1 deletion tests/onnxruntime/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
ORTModelForVision2Seq,
ORTStableDiffusionPipeline,
)
from optimum.onnxruntime.base import ORTDecoder, ORTDecoderForSeq2Seq, ORTEncoder
from optimum.onnxruntime.base import ORTDecoderForSeq2Seq, ORTEncoder
from optimum.onnxruntime.modeling_diffusion import (
ORTModelTextEncoder,
ORTModelUnet,
Expand Down

0 comments on commit 6c4e2fc

Please sign in to comment.