Skip to content

Commit d612abd

Browse files
authored
Add config overrides for protected namespaces to remove warnings for pydantic classes that have model_* params (#1657)
* Add config overrides for protected namespaces to remove warnings for pydantic classes that have model_* params * make quality
1 parent edd435f commit d612abd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/deepsparse/pipeline_config.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from typing import Any, Dict, List, Optional
1616

17-
from pydantic import BaseModel, Field
17+
from pydantic import BaseModel, ConfigDict, Field
1818

1919
from deepsparse.operators.engine_operator import DEEPSPARSE_ENGINE
2020

@@ -84,3 +84,6 @@ class PipelineConfig(BaseModel):
8484
"into the pipeline as kwargs"
8585
),
8686
)
87+
88+
# override name spaces due to model_ warnings in pydantic 2.X
89+
model_config = ConfigDict(protected_namespaces=())

src/deepsparse/server/server.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from typing import AsyncGenerator, List, Optional, Union
2121

2222
import yaml
23-
from pydantic import BaseModel
23+
from pydantic import BaseModel, ConfigDict
2424

2525
import uvicorn
2626
from deepsparse.benchmark.benchmark_pipeline import benchmark_from_pipeline
@@ -52,6 +52,9 @@ class CheckReady(BaseModel):
5252
class ModelMetaData(BaseModel):
5353
model_path: str
5454

55+
# override name spaces due to model_ warnings in pydantic 2.X
56+
model_config = ConfigDict(protected_namespaces=())
57+
5558

5659
# For deepsparse endpoints, we bind the `predict`` and `predict_from_files` functions to
5760
# each of the added routes. As we require access to the pipeline to run inference on

0 commit comments

Comments
 (0)