Skip to content

Commit 6a368d4

Browse files
committed
fix quality
1 parent c80695c commit 6a368d4

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/sagemaker_huggingface_inference_toolkit/optimum_utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_input_shapes(model_dir):
4242
logger.info(
4343
f"Input shapes found in config file. Using input shapes from config with batch size {input_shapes['batch_size']} and sequence length {input_shapes['sequence_length']}"
4444
)
45-
except:
45+
except Exception:
4646
input_shapes_available = False
4747

4848
# return input shapes if available
@@ -64,7 +64,7 @@ def get_input_shapes(model_dir):
6464

6565
def get_optimum_neuron_pipeline(task, model_dir):
6666
"""Method to get optimum neuron pipeline for a given task. Method checks if task is supported by optimum neuron and if required environment variables are set, in case model is not converted. If all checks pass, optimum neuron pipeline is returned. If checks fail, an error is raised."""
67-
from optimum.neuron.pipelines import pipeline, NEURONX_SUPPORTED_TASKS
67+
from optimum.neuron.pipelines import NEURONX_SUPPORTED_TASKS, pipeline
6868
from optimum.neuron.utils import NEURON_FILE_NAME
6969

7070
# check task support
@@ -78,9 +78,7 @@ def get_optimum_neuron_pipeline(task, model_dir):
7878
if NEURON_FILE_NAME in os.listdir(model_dir):
7979
export = False
8080
if export:
81-
logger.info(
82-
f"Model is not converted. Checking if required environment variables are set and converting model."
83-
)
81+
logger.info("Model is not converted. Checking if required environment variables are set and converting model.")
8482

8583
# get static input shapes to run inference
8684
input_shapes = get_input_shapes(model_dir)

tests/unit/test_optimum_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
@require_inferentia
4141
def test_not_supported_task():
4242
os.environ["HF_TASK"] = "not-supported-task"
43-
with pytest.raises(Exception) as e:
43+
with pytest.raises(Exception):
4444
get_optimum_neuron_pipeline(task=TASK, model_dir=os.getcwd())
4545

4646

0 commit comments

Comments
 (0)