code: def _from_bindings(
      cls, tm: bindings.v1CheckpointTrainingMetadata
  ) -> "Optional[CheckpointTrainingMetadata]":
      if not tm.trialId:
          return None
      assert tm.experimentConfig
      assert tm.experimentId
  
      return cls(
          experiment_config=tm.experimentConfig,
          experiment_id=tm.experimentId,
          trial_id=tm.trialId,
          hparams=tm.hparams or {},
          validation_metrics=tm.validationMetrics
          and tm.validationMetrics.to_json()
          or {},
      )
  
imports: import dataclasses
  import enum
  import json
  import logging
  import pathlib
  import shutil
  import sys
  import tarfile
  import warnings
  from typing import Any, Dict, Iterable, List, Optional
  from determined import errors
  from determined.common import api, constants, storage
  from determined.common.api import bindings
  from determined.common.experimental import metrics
  from determined.common.storage import shared
label_desc: Use image node_id 1 for calling the CheckpointTrainingMetadata obj's underlying member method code with example usage: obj._from_bindings(cls, tm) and returns: cls, None