Skip to content

Commit

Permalink
Add config overrides for protected namespaces to remove warnings for …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
markurtz authored Jul 18, 2024
1 parent edd435f commit d612abd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/deepsparse/pipeline_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from typing import Any, Dict, List, Optional

from pydantic import BaseModel, Field
from pydantic import BaseModel, ConfigDict, Field

from deepsparse.operators.engine_operator import DEEPSPARSE_ENGINE

Expand Down Expand Up @@ -84,3 +84,6 @@ class PipelineConfig(BaseModel):
"into the pipeline as kwargs"
),
)

# override name spaces due to model_ warnings in pydantic 2.X
model_config = ConfigDict(protected_namespaces=())
5 changes: 4 additions & 1 deletion src/deepsparse/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from typing import AsyncGenerator, List, Optional, Union

import yaml
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict

import uvicorn
from deepsparse.benchmark.benchmark_pipeline import benchmark_from_pipeline
Expand Down Expand Up @@ -52,6 +52,9 @@ class CheckReady(BaseModel):
class ModelMetaData(BaseModel):
model_path: str

# override name spaces due to model_ warnings in pydantic 2.X
model_config = ConfigDict(protected_namespaces=())


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

0 comments on commit d612abd

Please sign in to comment.