docstr: Deserializes the datalab object from disk.
docstr_tok: ["Deserializes","the","datalab","object","from","disk","."]
code: def deserialize(
      cls, path: str, data: Optional[Dataset] = None
  ) -> Datalab:
      """Deserializes the datalab object from disk."""
  
      if not os.path.exists(path):
          raise ValueError(f"No folder found at specified path: {path}")
  
      with open(os.path.join(path, OBJECT_FILENAME), "rb") as f:
          datalab: Datalab = pickle.load(f)
  
      cls._validate_version(datalab)
  
      # Load the issues from disk.
      issues_path = os.path.join(path, ISSUES_FILENAME)
      if not hasattr(datalab.data_issues, "issues") and os.path.exists(
          issues_path
      ):
          datalab.data_issues.issues = pd.read_csv(issues_path)
  
      issue_summary_path = os.path.join(path, ISSUE_SUMMARY_FILENAME)
      if not hasattr(
          datalab.data_issues, "issue_summary"
      ) and os.path.exists(issue_summary_path):
          datalab.data_issues.issue_summary = pd.read_csv(
              issue_summary_path
          )
  
      if data is not None:
          if hash(data) != hash(datalab._data):
              raise ValueError(
                  "Data has been modified since Lab was saved. "
                  "Cannot load Lab with modified data."
              )
  
          if len(data) != len(datalab.labels):
              raise ValueError(
                  f"Length of data ({len(data)}) does not match length of labels ({len(datalab.labels)})"
              )
  
          datalab._data = Data(data, datalab.label_name)
          datalab.data = datalab._data._data
  
      return datalab
  
file_path: cleanlab/cleanlab/datalab/internal/serialize.py
imports: from __future__ import annotations
  import os
  import pickle
  import warnings
  from typing import TYPE_CHECKING, Optional
  import pandas
  import cleanlab
  from cleanlab.datalab.internal.data import Data
label_desc: Use image node_id 5 for calling the _Serializer obj's underlying member method code with example usage: obj.deserialize(cls, path, data) and returns: datalab