code: def test_from_dict(self):
      data = {
          "type": "haystack.components.generators.hugging_face_local.HuggingFaceLocalGenerator",
          "init_parameters": {
              "huggingface_pipeline_kwargs": {
                  "model": "gpt2",
                  "task": "text-generation",
                  "device": "cuda:0",
                  "model_kwargs": {
                      "load_in_4bit": True,
                      "bnb_4bit_use_double_quant": True,
                      "bnb_4bit_quant_type": "nf4",
                      # dtype is correctly serialized
                      "bnb_4bit_compute_dtype": "torch.bfloat16",
                  },
              },
              "generation_kwargs": {
                  "max_new_tokens": 100,
                  "return_full_text": False,
              },
              "stop_words": ["coca", "cola"],
          },
      }
  
      component = HuggingFaceLocalGenerator.from_dict(data)
  
      assert component.huggingface_pipeline_kwargs == {
          "model": "gpt2",
          "task": "text-generation",
          "device": "cuda:0",
          "token": None,
          "model_kwargs": {
              "load_in_4bit": True,
              "bnb_4bit_use_double_quant": True,
              "bnb_4bit_quant_type": "nf4",
              # dtype is correctly deserialized
              "bnb_4bit_compute_dtype": torch.bfloat16,
          },
      }
      assert component.generation_kwargs == {
          "max_new_tokens": 100,
          "return_full_text": False,
      }
      assert component.stop_words == ["coca", "cola"]
  
imports: from unittest.mock import patch, Mock
  import pytest
  import torch
  from transformers import PreTrainedTokenizerFast
  from haystack.components.generators.hugging_face_local import HuggingFaceLocalGenerator, StopWordsCriteria
label_desc: Use image node_id 15 for calling the TestHuggingFaceLocalGenerator obj's underlying member method code with example usage: obj.test_from_dict() without return types