"magic_pdf/git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "b0529b6fbd1bf65648d7d591c5e8f225cd7409c8"
Commit bcc4f9d6 authored by Hongkun Yu's avatar Hongkun Yu Committed by A. Unique TensorFlower
Browse files

Update `Config` class doc to warn the auto conversion of dict to `Config` class.

PiperOrigin-RevId: 369588823
parent 296d7494
......@@ -30,11 +30,15 @@ from official.modeling.hyperparams import params_dict
class Config(params_dict.ParamsDict):
"""The base configuration class that supports YAML/JSON based overrides.
Because of YAML/JSON serialization limitations, some semantics of dataclass
are not supported:
* It recursively enforces a allowlist of basic types and container types, so
it avoids surprises with copy and reuse caused by unanticipated types.
* It converts dict to Config even within sequences,
* Warning: it converts Dict to `Config` even within sequences,
e.g. for config = Config({'key': [([{'a': 42}],)]),
type(config.key[0][0][0]) is Config rather than dict.
If you define/annotate some field as Dict, the field will convert to a
`Config` instance and lose the dictionary type.
"""
# It's safe to add bytes and other immutable types here.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment