Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config overrides for protected namespaces to remove warnings for pydantic classes that have model_* params #1657

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading