code: def _test_checkpoint_decoder(
      dev_source_path: str, dev_target_path: str, model_path: str
  ):
      """
      Runs checkpoint decoder on 10% of the dev data and checks whether metric
      keys are present in the result dict. Also checks that we can reload model
      parameters after running the checkpoint decoder (case when using the
      plateau-reduce scheduler).
      """
      with open(dev_source_path) as dev_fd:
          num_dev_sent = sum(1 for _ in dev_fd)
      sample_size = min(1, int(num_dev_sent * 0.1))
  
      model, source_vocabs, target_vocabs = load_model(
          model_folder=model_path, device=pt.device("cpu")
      )
  
      cp_decoder = sockeye.checkpoint_decoder.CheckpointDecoder(
          device=pt.device("cpu"),
          inputs=[dev_source_path],
          references=[dev_target_path],
          source_vocabs=source_vocabs,
          target_vocabs=target_vocabs,
          model=model,
          model_folder=model_path,
          sample_size=sample_size,
          batch_size=2,
          beam_size=2,
      )
      cp_metrics = cp_decoder.decode_and_evaluate()
      logger.info("Checkpoint decoder metrics: %s", cp_metrics)
      assert "bleu" in cp_metrics
      assert "chrf" in cp_metrics
      assert "decode-walltime" in cp_metrics
  
      model.load_parameters(
          os.path.join(model_path, C.PARAMS_BEST_NAME),
          device=pt.device("cpu"),
      )
  
imports: import logging
  import os
  import platform
  import sys
  from tempfile import TemporaryDirectory
  from typing import List
  from unittest.mock import patch
  import pytest
  import torch
  import sockeye.average
  import sockeye.checkpoint_decoder
  import sockeye.evaluate
  from sockeye import constants
  from sockeye.config import Config
  from sockeye.model import load_model
  from sockeye.test_utils import run_train_translate, tmp_digits_dataset
  from test.common import check_train_translate
label_desc: Use image node_id 5 for calling a global function with example usage: _test_checkpoint_decoder(dev_source_path, dev_target_path, model_path) without return types