mirror of
https://github.com/google-deepmind/deepmind-research.git
synced 2026-05-10 21:47:16 +08:00
c146166d4b
PiperOrigin-RevId: 346305536
30 lines
964 B
Python
30 lines
964 B
Python
# Copyright 2020 DeepMind Technologies Limited.
|
|
#
|
|
#
|
|
# 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
|
|
#
|
|
# https://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.
|
|
|
|
"""Checkpoint restoring utilities."""
|
|
|
|
from absl import logging
|
|
import dill
|
|
|
|
|
|
def load_checkpoint(checkpoint_path):
|
|
try:
|
|
with open(checkpoint_path, 'rb') as checkpoint_file:
|
|
checkpoint_data = dill.load(checkpoint_file)
|
|
logging.info('Loading checkpoint from %s', checkpoint_path)
|
|
return checkpoint_data
|
|
except FileNotFoundError:
|
|
return None
|