code: def write_metric(
      summary_writer, train_metrics, eval_metrics, train_time, step
  ):
      summary_writer.scalar("train_time", train_time, step)
  
      train_metrics = get_metrics(train_metrics)
      for key, vals in train_metrics.items():
          tag = f"train_{key}"
          for i, val in enumerate(vals):
              summary_writer.scalar(tag, val, step - len(vals) + i + 1)
  
      for metric_name, value in eval_metrics.items():
          summary_writer.scalar(f"eval_{metric_name}", value, step)
  
imports: import logging
  import os
  import sys
  import time
  from dataclasses import asdict, dataclass, field
  from enum import Enum
  from pathlib import Path
  from typing import Callable, Optional
  import torch
  import torchvision
  import torchvision.transforms
  from tqdm import tqdm
  import jax
  import jax.numpy
  import optax
  import transformers
  from flax import jax_utils
  from flax.jax_utils import pad_shard_unpad, unreplicate
  from flax.training import train_state
  from flax.training.common_utils import get_metrics, onehot, shard, shard_prng_key
  from huggingface_hub import Repository
  from transformers import CONFIG_MAPPING, FLAX_MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING, AutoConfig, FlaxAutoModelForImageClassification, HfArgumentParser, is_tensorboard_available, set_seed
  from transformers.utils import get_full_repo_name, send_example_telemetry
label_desc: Use image node_id 1 for calling a global function with example usage: write_metric(summary_writer, train_metrics, eval_metrics, train_time, step) without return types