code: def to_half(self):
      if self.int8:
          raise RuntimeError(
              "Cannot cast to half if the weights have been casted to int8."
          )
      for k, v in self.weights.items():
          self.weights[k] = v.half()
  
imports: from typing import List, Optional
  from loguru import logger
  from nebullvm.optional_modules.torch import torch, torch_distributed
  from nebullvm.optional_modules.huggingface import BertConfig, BertEmbeddings, BertEncoder, BertPooler, BertPreTrainedModel
  from .checkpoint_quantization import checkpoint_quantization
label_desc: Use image node_id 4 for calling the EncoderWeights obj's underlying member method code with example usage: obj.to_half() without return types