diff --git a/README.md b/README.md index 1863e4b..1c860a8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ For more examples see [test_ndarray.py](./tests/test_ndarray.py) ```python import pydantic_numpy.dtype as pnd -from pydantic_numpy import NDArray, NDArrayFp32, NumpyModel + from pydantic_numpy import NDArray, NDArrayFp32, NumpyModel, model_agnostic_load class MyPydanticNumpyModel(NumpyModel): @@ -31,10 +31,12 @@ cfg = MyPydanticNumpyModel(K={"path": "path_to/array.npz", "key": "K"}) cfg.K # np.ndarray[np.float32] -cfg.dump("path_to_dump") -cfg.load("path_to_dump") +cfg.dump("path_to_dump_dir", "object_id") +cfg.load("path_to_dump_dir", "object_id") ``` +`NumpyModel.load` requires the original mode, use `model_agnostic_load` when you have several models, and you want to load into a set of possible models. + ### Data type (dtype) support! This package also comes with `pydantic_numpy.dtype`, which adds subtyping support such as `NDArray[float, pnd.float32]`. All subfields must be from this package as numpy dtypes have no Pydantic support, which is implemented in this package through the [generic class workflow](https://pydantic-docs.helpmanual.io/usage/types/#generic-classes-as-types).