Skip to content

Commit

Permalink
Add checkpoint utility.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 638573481
  • Loading branch information
jaindeepali authored and copybara-github committed May 30, 2024
1 parent 33e16e2 commit 2afeb37
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions iris/checkpoint_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Utilities for interacting with BBv2 checkpoints."""

import pickle as pkl
from typing import Any

from absl import logging


def load_checkpoint_state_oss(path: str) -> dict[str, Any]:
"""Loads a checkpoint state from a given path."""
with open(path, "rb") as f:
state = pkl.load(f)
return state

load_checkpoint_state = load_checkpoint_state_oss

0 comments on commit 2afeb37

Please sign in to comment.