Skip to content

Commit

Permalink
avoid warning
Browse files Browse the repository at this point in the history
  • Loading branch information
JingyaHuang committed Oct 9, 2024
1 parent c9ae056 commit b0b7bb5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion optimum/neuron/pipelines/transformers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""Pipelines running different Neuron Accelerators."""

import logging
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, List, Optional, Union

from transformers import (
AudioClassificationPipeline,
Expand Down Expand Up @@ -133,6 +133,13 @@
}


def check_model_type(self, supported_models: Union[List[str], dict]):
"""
Dummy function to avoid the error logs raised by https://github.com/huggingface/transformers/blob/v4.45.2/src/transformers/pipelines/base.py#L1091
"""
pass


def load_pipeline(
model,
targeted_task,
Expand Down Expand Up @@ -309,6 +316,9 @@ def pipeline(
else:
tokenizer.pad_token_id = model.config.eos_token_id

if hasattr(NEURONX_SUPPORTED_TASKS[task]["impl"], "check_model_type"):
NEURONX_SUPPORTED_TASKS[task]["impl"].check_model_type = check_model_type

return transformers_pipeline(
task,
model=model,
Expand Down

0 comments on commit b0b7bb5

Please sign in to comment.