class_docstr: The label model by `Snorkel <https://github.com/snorkel-team/snorkel/>`__.
  
  .. note:: It is not suited for multi-label classification and does not support it!
  
  Args:
      weak_labels: A `WeakLabels` object containing the weak labels and records.
      verbose: Whether to show print statements
      device: What device to place the model on ('cpu' or 'cuda:0', for example).
          Passed on to the `torch.Tensor.to()` calls.
  
  Examples:
      >>> from argilla.labeling.text_classification import WeakLabels
      >>> weak_labels = WeakLabels(dataset="my_dataset")
      >>> label_model = Snorkel(weak_labels)
      >>> label_model.fit()
      >>> records = label_model.predict()
class_docstr_tok: ["The","label","model","by","`","Snorkel","<","https",":","\/\/github.com\/snorkel-team\/snorkel\/",">","`","__",".","..","note",":",":","It","is","not","suited","for","multi-label","classification","and","does","not","support","it","!","Args",":","weak_labels",":","A","`","WeakLabels","`","object","containing","the","weak","labels","and","records",".","verbose",":","Whether","to","show","print","statements","device",":","What","device","to","place","the","model","on","(","'cpu","'","or","'cuda:0","'",",","for","example",")",".","Passed","on","to","the","`","torch.Tensor.to","(",")","`","calls",".","Examples",":",">",">",">","from","argilla.labeling.text_classification","import","WeakLabels",">",">",">","weak_labels","=","WeakLabels","(","dataset=","''","my_dataset","''",")",">",">",">","label_model","=","Snorkel","(","weak_labels",")",">",">",">","label_model.fit","(",")",">",">",">","records","=","label_model.predict","(",")"]
code: def __init__(
      self,
      weak_labels: WeakLabels,
      verbose: bool = True,
      device: str = "cpu",
  ):
      from snorkel.labeling.model import LabelModel as SnorkelLabelModel
  
      super().__init__(weak_labels)
  
      # Check if we need to remap the weak labels to int mapping
      # Snorkel expects the abstain id to be -1 and the rest of the labels to be sequential
      if self._weak_labels.label2int[None] != -1 or sorted(
          self._weak_labels.int2label
      ) != list(range(-1, self._weak_labels.cardinality)):
          self._need_remap = True
          self._weaklabelsInt2snorkelInt = {
              self._weak_labels.label2int[label]: i
              for i, label in enumerate(
                  [None] + self._weak_labels.labels, -1
              )
          }
      else:
          self._need_remap = False
          self._weaklabelsInt2snorkelInt = {
              i: i for i in range(-1, self._weak_labels.cardinality)
          }
  
      self._snorkelInt2weaklabelsInt = {
          val: key
          for key, val in self._weaklabelsInt2snorkelInt.items()
      }
  
      # instantiate Snorkel's label model
      self._model = SnorkelLabelModel(
          cardinality=self._weak_labels.cardinality,
          verbose=verbose,
          device=device,
      )
  
imports: import hashlib
  import logging
  from enum import Enum
  from typing import Dict, List, Tuple, Union
  import numpy
  from argilla import DatasetForTextClassification, TextClassificationRecord
  from argilla.labeling.text_classification.weak_labels import WeakLabels, WeakMultiLabels
  from argilla.utils.dependency import requires_dependencies
label_desc: Use image node_id 1 to create a new Snorkel object from inherited base classes: LabelModel with example: obj = Snorkel(weak_labels, verbose, device)