code: def test_hyperparameter_optimization(
      self, environment, project, common_tag
  ):
      # given
      n_trials = 5
  
      # and
      def model_init():
          config = RegressionModelConfig()
          return RegressionPreTrainedModel(config)
  
      # and
      callback = NeptuneCallback(
          project=environment.project,
          api_token=environment.user_token,
          tags=common_tag,
      )
      trainer_config = self._trainer_default_attributes
      del trainer_config["model"]
      trainer = Trainer(
          **trainer_config, model_init=model_init, callbacks=[callback]
      )
  
      # when
      trainer.hyperparameter_search(
          backend="optuna",
          n_trials=n_trials,
          hp_name=lambda trial: f"trial_{trial.number}",
      )
      time.sleep(SECONDS_TO_WAIT_FOR_UPDATE)
  
      # then
      runs = sorted(
          project.fetch_runs_table(tag=common_tag).to_rows(),
          key=lambda run: run.get_attribute_value("sys/id"),
      )
      assert len(runs) == n_trials
      for run_id, run in enumerate(runs):
          assert (
              run.get_attribute_value("finetuning/trial")
              == f"trial_{run_id}"
          )
          assert self._test_monitoring_cpu_present(environment, run)
  
imports: import os
  import time
  from zipfile import ZipFile
  import numpy
  import pytest
  import torch
  from faker import Faker
  from transformers import PretrainedConfig, PreTrainedModel, Trainer, TrainingArguments
  from transformers.integrations import NeptuneCallback, NeptuneMissingConfiguration
  from transformers.utils import logging
  from neptune import init_run
  from neptune.metadata_containers.metadata_containers_table import TableEntry
  from tests.e2e.base import BaseE2ETest
  from tests.e2e.utils import catch_time, modified_environ, tmp_context
label_desc: Use image node_id 16 for calling the TestHuggingFace obj's underlying member method code with example usage: obj.test_hyperparameter_optimization(environment, project, common_tag) and returns: RegressionPreTrainedModel