Closed jdeschamps closed 1 month ago
until we found the issue we could pin pydantic to <2.9. PR for fix or the pin welcome
I couldn't find what really causes this problem but if I comment this line:
NonBatchAxisId = Annotated[AxisId, Predicate(lambda x: x != "batch")]
The axis will have the given id
.
So, instead of Predicate
from annotated_types package, I used pydantic StringConstraints
with a regex pattern:
NonBatchAxisId = Annotated[AxisId, StringConstraints(pattern="[^batch$].*")]
Then the axis will receive the AxisId
properly.
from bioimageio.spec.model.v0_5 import SpaceInputAxis
ax1 = SpaceInputAxis(id=AxisId("y"), size=100)
print(ax1)
# size=100 id='y' description='' type='space' unit=None scale=1.0 concatenable=False
caused by https://github.com/pydantic/pydantic/issues/10319 fixed on pydantic side with https://github.com/pydantic/pydantic/pull/10321 We should update our pydantic pin as commented in #632 to avoid running into this issue.
issue was in pydantic and has been patched
Pydantic 2.9 was released yesterday and it caused ids to not properly validates in
SpaceInputAxis
. Given the following snippet:We get different class attributes value depending on the package version.
Pydantic 2.8:
Pydantic 2.9:
which down the line raises an error when trying to package all this into a
InputTensorDescr
: