code: def explicit_models_trained_for_one_step(
      request,
      train_val_explicit_sample_data,
      movielens_metadata_df,
      user_metadata_df,
      gpu_count,
  ):
      train, val = train_val_explicit_sample_data
  
      genres = (
          torch.tensor(
              movielens_metadata_df[
                  [
                      c
                      for c in movielens_metadata_df.columns
                      if "genre" in c
                  ]
              ].values
          )
          .topk(1)
          .indices.view(-1)
      )
  
      number_of_stages = None
  
      if request.param == "mf":
          model = MatrixFactorizationModel(
              train=train, val=val, loss="mse"
          )
      if request.param == "sparse_mf":
          model = MatrixFactorizationModel(
              train=train,
              val=val,
              embedding_dim=15,
              dropout_p=0.1,
              lr=1e-1,
              bias_lr=1e-2,
              optimizer="sparse_adam",
              bias_optimizer="sgd",
              weight_decay=0,
              loss="mse",
              sparse=True,
          )
      elif request.param == "nonlinear_mf":
          model = NonlinearMatrixFactorizationModel(
              train=train,
              val=val,
              user_embedding_dim=15,
              item_embedding_dim=15,
              user_dense_layers_dims=[15, 10],
              item_dense_layers_dims=[15, 10],
              embedding_dropout_p=0.05,
              dense_dropout_p=0.1,
              lr=1e-1,
              bias_lr=1e-2,
              optimizer="adam",
              bias_optimizer="sgd",
              weight_decay=1e-7,
              loss="mse",
          )
      elif request.param == "neucf":
          model = NeuralCollaborativeFiltering(
              train=train,
              val=val,
              embedding_dim=10,
              num_layers=1,
              dropout_p=0.1,
              lr=1e-4,
              weight_decay=0.0,
              optimizer="adam",
              loss="mae",
          )
      elif request.param == "hybrid_pretrained":
          implicit_model = MatrixFactorizationModel(
              train=train,
              val=val,
              embedding_dim=10,
              lr=1e-1,
              optimizer="adam",
              loss="mse",
          )
          implicit_model_trainer = CollieTrainer(
              model=implicit_model,
              gpus=gpu_count,
              max_epochs=1,
              deterministic=True,
              logger=False,
              enable_checkpointing=False,
          )
          implicit_model_trainer.fit(implicit_model)
          implicit_model.freeze()
  
          genres = (
              torch.tensor(
                  movielens_metadata_df[
                      [
                          c
                          for c in movielens_metadata_df.columns
                          if "genre" in c
                      ]
                  ].values
              )
              .topk(1)
              .indices.view(-1)
          )
  
          model_frozen = HybridPretrainedModel(
              train=train,
              val=val,
              item_metadata=movielens_metadata_df,
              trained_model=implicit_model,
              item_metadata_layers_dims=None,
              user_metadata=user_metadata_df,
              user_metadata_layers_dims=None,
              freeze_embeddings=True,
              dropout_p=0.15,
              loss="mae",
              lr=0.01,
              optimizer=torch.optim.Adam,
              metadata_for_loss={"genre": genres},
              metadata_for_loss_weights={"genre": 0.4},
              weight_decay=0.0,
          )
          model_frozen_trainer = CollieTrainer(
              model=model_frozen,
              gpus=gpu_count,
              max_epochs=1,
              deterministic=True,
              logger=False,
              enable_checkpointing=False,
          )
          model_frozen_trainer.fit(model_frozen)
  
          model = HybridPretrainedModel(
              train=train,
              val=val,
              item_metadata=movielens_metadata_df,
              trained_model=implicit_model,
              item_metadata_layers_dims=None,
              user_metadata=user_metadata_df,
              user_metadata_layers_dims=None,
              freeze_embeddings=False,
              dropout_p=0.15,
              loss="mse",
              lr=1e-4,
              optimizer=torch.optim.Adam,
              metadata_for_loss={"genre": genres},
              metadata_for_loss_weights={"genre": 0.4},
              weight_decay=0.0,
          )
          model.load_from_hybrid_model(model_frozen)
      elif request.param == "hybrid_mf":
          number_of_stages = 3
  
          model = HybridModel(
              train=train,
              val=val,
              item_metadata=movielens_metadata_df,
              embedding_dim=10,
              item_metadata_layers_dims=[16, 12],
              user_metadata=user_metadata_df,
              user_metadata_layers_dims=[16, 12],
              lr=1e-1,
              loss="mae",
              optimizer="adam",
          )
      elif request.param == "cold_start":
          number_of_stages = 2
  
          model = ColdStartModel(
              train=train,
              val=val,
              item_buckets=genres[: train.num_items],
              embedding_dim=10,
              item_buckets_stage_lr=1e-2,
              no_buckets_stage_lr=1e-2,
              loss="mse",
              item_buckets_stage_optimizer="sgd",
          )
  
      model_trainer = CollieTrainer(
          model=model,
          gpus=gpu_count,
          max_epochs=1,
          deterministic=True,
          logger=False,
          enable_checkpointing=False,
      )
  
      if request.param == "mf_no_val":
          with pytest.warns(UserWarning):
              model_trainer.fit(model)
      else:
          if number_of_stages is None:
              model_trainer.fit(model)
          else:
              for idx in range(number_of_stages):
                  model_trainer.fit(model)
  
                  if idx < (number_of_stages - 1):
                      model_trainer.max_epochs += 1
                      model.advance_stage()
  
      model.freeze()
  
      return model
  
file_path: collie/tests/fixtures/model_fixtures.py
imports: import os
  import tempfile
  import pytest
  import torch
  from collie.interactions import ApproximateNegativeSamplingInteractionsDataLoader, HDF5InteractionsDataLoader, InteractionsDataLoader
  from collie.model import ColdStartModel, CollaborativeMetricLearningModel, CollieMinimalTrainer, CollieTrainer, DeepFM, HybridModel, HybridPretrainedModel, MatrixFactorizationModel, MLPMatrixFactorizationModel, NeuralCollaborativeFiltering, NonlinearMatrixFactorizationModel
  from collie.utils import pandas_df_to_hdf5
label_desc: Use image node_id 8 for calling a global function with example usage: explicit_models_trained_for_one_step(request, train_val_explicit_sample_data, movielens_metadata_df, user_metadata_df, gpu_count) and returns: model