microsoft / Olive

Olive: Simplify ML Model Finetuning, Conversion, Quantization, and Optimization for CPUs, GPUs and NPUs.
https://microsoft.github.io/Olive/
MIT License
1.6k stars 168 forks source link

[Bug]: To define root models, use `pydantic.RootModel` rather than a field called '__root__' #446

Closed AnnaBolshich closed 1 year ago

AnnaBolshich commented 1 year ago

What happened?

When trying to run python -m olive.workflows.run --config resnet_static_ptq_cpu.json --setup I got this error

/miniconda3/envs/olive_env/lib/python3.11/site-packages/pydantic/_internal/_config.py:269: UserWarning: Valid config keys have changed in V2:

I understand that this is version mismatch. How can I fix it?

Version?

Name Version Build Channel

_libgcc_mutex 0.1 main
_openmp_mutex 5.1 1_gnu
alembic 1.11.1 pypi_0 pypi annotated-types 0.5.0 pypi_0 pypi bzip2 1.0.8 h7b6447c_0
ca-certificates 2023.05.30 h06a4308_0
certifi 2023.7.22 pypi_0 pypi charset-normalizer 3.2.0 pypi_0 pypi cmaes 0.10.0 pypi_0 pypi cmake 3.27.0 pypi_0 pypi coloredlogs 15.0.1 pypi_0 pypi colorlog 6.7.0 pypi_0 pypi filelock 3.12.2 pypi_0 pypi flatbuffers 23.5.26 pypi_0 pypi fsspec 2023.6.0 pypi_0 pypi greenlet 2.0.2 pypi_0 pypi huggingface-hub 0.16.4 pypi_0 pypi humanfriendly 10.0 pypi_0 pypi idna 3.4 pypi_0 pypi jinja2 3.1.2 pypi_0 pypi ld_impl_linux-64 2.38 h1181459_1
libffi 3.4.4 h6a678d5_0
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libstdcxx-ng 11.2.0 h1234567_1
libuuid 1.41.5 h5eee18b_0
lit 16.0.6 pypi_0 pypi mako 1.2.4 pypi_0 pypi markupsafe 2.1.3 pypi_0 pypi mpmath 1.3.0 pypi_0 pypi ncurses 6.4 h6a678d5_0
networkx 3.1 pypi_0 pypi numpy 1.23.4 pypi_0 pypi nvidia-cublas-cu11 11.10.3.66 pypi_0 pypi nvidia-cuda-cupti-cu11 11.7.101 pypi_0 pypi nvidia-cuda-nvrtc-cu11 11.7.99 pypi_0 pypi nvidia-cuda-runtime-cu11 11.7.99 pypi_0 pypi nvidia-cudnn-cu11 8.5.0.96 pypi_0 pypi nvidia-cufft-cu11 10.9.0.58 pypi_0 pypi nvidia-curand-cu11 10.2.10.91 pypi_0 pypi nvidia-cusolver-cu11 11.4.0.1 pypi_0 pypi nvidia-cusparse-cu11 11.7.4.91 pypi_0 pypi nvidia-nccl-cu11 2.14.3 pypi_0 pypi nvidia-nvtx-cu11 11.7.91 pypi_0 pypi olive-ai 0.2.1 pypi_0 pypi onnx 1.14.0 pypi_0 pypi onnxruntime 1.15.0 pypi_0 pypi openssl 3.0.9 h7f8727e_0
optuna 3.2.0 pypi_0 pypi packaging 23.1 pypi_0 pypi pandas 2.0.3 pypi_0 pypi pillow 10.0.0 pypi_0 pypi pip 23.2.1 py311h06a4308_0
protobuf 4.23.4 pypi_0 pypi pydantic 2.1.1 pypi_0 pypi pydantic-core 2.4.0 pypi_0 pypi python 3.11.4 h955ad1f_0
python-dateutil 2.8.2 pypi_0 pypi pytz 2023.3 pypi_0 pypi pyyaml 6.0.1 pypi_0 pypi readline 8.2 h5eee18b_0
regex 2023.6.3 pypi_0 pypi requests 2.31.0 pypi_0 pypi safetensors 0.3.1 pypi_0 pypi setuptools 68.0.0 py311h06a4308_0
six 1.16.0 pypi_0 pypi sqlalchemy 2.0.19 pypi_0 pypi sqlite 3.41.2 h5eee18b_0
sympy 1.12 pypi_0 pypi tk 8.6.12 h1ccaba5_0
tokenizers 0.13.3 pypi_0 pypi torch 2.0.1 pypi_0 pypi torchmetrics 0.10.0 pypi_0 pypi torchvision 0.15.2 pypi_0 pypi tqdm 4.65.0 pypi_0 pypi transformers 4.31.0 pypi_0 pypi triton 2.0.0 pypi_0 pypi typing-extensions 4.7.1 pypi_0 pypi tzdata 2023.3 pypi_0 pypi urllib3 2.0.4 pypi_0 pypi wheel 0.38.4 py311h06a4308_0
xz 5.4.2 h5eee18b_0
zlib 1.2.13 h5eee18b_0

guotuofeng commented 1 year ago

you can downgrade pydantic to 1.x like https://github.com/microsoft/Olive/blob/main/requirements.txt#L5

shijunz commented 1 year ago

you can downgrade pydantic to 1.x like https://github.com/microsoft/Olive/blob/main/requirements.txt#L5

o, do you verify and pass it?

chryseosTang commented 1 year ago

i got that, you can use root instead root
eg: class UserOrderStatusCounts(RootModel): root: Dict[str, int]