code: def test_set_parameters_ignore_extra():
      model = mock_model()
      sockeye.model.initialize_parameters(model)
      model_params = dict(model.named_parameters())
  
      p = pt.nn.Parameter(pt.ones(20, 4))
      np = "embedding_source.embedding.weight"
      q = pt.nn.Parameter(pt.zeros(1, 1))
      nq = "q"
      params = {np: p, nq: q}
      model.set_parameters(params, ignore_extra=True)
      assert "embedding_source.embedding.weight" in model_params
      assert "q" not in model_params
      with pytest.raises(ValueError) as e:
          model.set_parameters(params, ignore_extra=False)
      assert (
          str(e.value)
          == "Parameter 'q' in new_params dictionary is not present in ParameterDict. "
          "Set ignore_extra=True to ignore."
      )
  
file_path: sockeye/test/unit/test_params.py
imports: import glob
  import itertools
  import os.path
  import tempfile
  import pytest
  import torch
  import sockeye.constants
  import sockeye.encoder
  import sockeye.model
  import sockeye.training
label_desc: Use image node_id 6 for calling a global function with example usage: test_set_parameters_ignore_extra() without return types