镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Raise ValueError in model.load_mmm() for proto and unpicklable files. - #2006

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1020145973
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1020145973

Conversation

@copybara-service

Copy link
Copy Markdown

Raise ValueError in model.load_mmm() for proto and unpicklable files.

Passing a .binpb protobuf model saved by meridian_serde.save_meridian() to the deprecated model.load_mmm() function previously failed inside joblib.load() with an opaque KeyError: 10 because binary MmmKernel protobufs start with wire tag 0x0a (decimal 10).

Check for .binpb, .txtpb, and .textproto suffixes (case-insensitive) upfront in model.load_mmm() and catch (pickle.UnpicklingError, KeyError, EOFError) around joblib.load(), raising a descriptive ValueError (chained with from e) directing users to meridian.schema.serde.meridian_serde.load_meridian().

Passing a `.binpb` protobuf model saved by `meridian_serde.save_meridian()` to the deprecated `model.load_mmm()` function previously failed inside `joblib.load()` with an opaque `KeyError: 10` because binary `MmmKernel` protobufs start with wire tag `0x0a` (decimal `10`).

Check for `.binpb`, `.txtpb`, and `.textproto` suffixes (case-insensitive) upfront in `model.load_mmm()` and catch `(pickle.UnpicklingError, KeyError, EOFError)` around `joblib.load()`, raising a descriptive `ValueError` (chained with `from e`) directing users to `meridian.schema.serde.meridian_serde.load_meridian()`.

PiperOrigin-RevId: 1020145973

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant