Skip to content

Commit

Permalink
Downgrade Pydantic to < 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywonchung committed Sep 27, 2023
1 parent 6082db4 commit d3ccbb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"pandas",
"scikit-learn",
"nvidia-ml-py",
"pydantic",
"pydantic<2",
"rich",
]
dynamic = ["version"]
Expand Down
15 changes: 9 additions & 6 deletions zeus/optimizer/power_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,13 @@ def __init__(
self.logger.info("Set power limit to the maximum before starting.")
self._set_power_limit(max(self.power_limits))
else:
self.measurements = _PowerLimitMeasurementList.model_validate_json(
open(self.profile_path).read(),
strict=True,
self.measurements = _PowerLimitMeasurementList.parse_file(
self.profile_path,
).measurements
# self.measurements = _PowerLimitMeasurementList.model_validate_json(
# open(self.profile_path).read(),
# strict=True,
# ).measurements
self.logger.info(
"Loaded previous profiling results from '%s'.", str(self.profile_path)
)
Expand Down Expand Up @@ -460,8 +463,8 @@ def _save_profile(self) -> None:
assert isinstance(self.state, Done)
with self.profile_path.open("w", encoding="utf-8") as f:
f.write(
_PowerLimitMeasurementList(
measurements=self.measurements
).model_dump_json(indent=4)
_PowerLimitMeasurementList(measurements=self.measurements).json(
indent=4
),
)
self.logger.info("JIT profiling results saved to '%s'.", str(self.profile_path))

0 comments on commit d3ccbb5

Please sign in to comment.