class_docstr: Facilitate Featurization of In-memory objects.
  
  When featurizing a dataset, it's often the case that the initial set of
  data (pre-featurization) fits handily within memory. (For example, perhaps
  it fits within a column of a pandas DataFrame.) In this case, it would be
  convenient to directly be able to featurize this column of data. However,
  the process of featurization often generates large arrays which quickly eat
  up available memory. This class provides convenient capabilities to process
  such in-memory data by checkpointing generated features periodically to
  disk.
  
  Example
  -------
  Here's an example with only datapoints and no labels or weights.
  
  >>> import deepchem as dc
  >>> smiles = ["C", "CC", "CCC", "CCCC"]
  >>> featurizer = dc.feat.CircularFingerprint()
  >>> loader = dc.data.InMemoryLoader(tasks=["task1"], featurizer=featurizer)
  >>> dataset = loader.create_dataset(smiles, shard_size=2)
  >>> len(dataset)
  4
  
  Here's an example with both datapoints and labels
  
  >>> import deepchem as dc
  >>> smiles = ["C", "CC", "CCC", "CCCC"]
  >>> labels = [1, 0, 1, 0]
  >>> featurizer = dc.feat.CircularFingerprint()
  >>> loader = dc.data.InMemoryLoader(tasks=["task1"], featurizer=featurizer)
  >>> dataset = loader.create_dataset(zip(smiles, labels), shard_size=2)
  >>> len(dataset)
  4
  
  Here's an example with datapoints, labels, weights and ids all provided.
  
  >>> import deepchem as dc
  >>> smiles = ["C", "CC", "CCC", "CCCC"]
  >>> labels = [1, 0, 1, 0]
  >>> weights = [1.5, 0, 1.5, 0]
  >>> ids = ["C", "CC", "CCC", "CCCC"]
  >>> featurizer = dc.feat.CircularFingerprint()
  >>> loader = dc.data.InMemoryLoader(tasks=["task1"], featurizer=featurizer)
  >>> dataset = loader.create_dataset(zip(smiles, labels, weights, ids), shard_size=2)
  >>> len(dataset)
  4
class_docstr_tok: ["Facilitate","Featurization","of","In-memory","objects",".","When","featurizing","a","dataset",",","it","'s","often","the","case","that","the","initial","set","of","data","(","pre-featurization",")","fits","handily","within","memory",".","(","For","example",",","perhaps","it","fits","within","a","column","of","a","pandas","DataFrame",".",")","In","this","case",",","it","would","be","convenient","to","directly","be","able","to","featurize","this","column","of","data",".","However",",","the","process","of","featurization","often","generates","large","arrays","which","quickly","eat","up","available","memory",".","This","class","provides","convenient","capabilities","to","process","such","in-memory","data","by","checkpointing","generated","features","periodically","to","disk",".","Example","--","--","--","-","Here","'s","an","example","with","only","datapoints","and","no","labels","or","weights",".",">",">",">","import","deepchem","as","dc",">",">",">","smiles","=","[","``","C","''",",","``","CC","''",",","``","CCC","''",",","``","CCCC","''","]",">",">",">","featurizer","=","dc.feat.CircularFingerprint","(",")",">",">",">","loader","=","dc.data.InMemoryLoader","(","tasks=","[","``","task1","''","]",",","featurizer=featurizer",")",">",">",">","dataset","=","loader.create_dataset","(","smiles",",","shard_size=2",")",">",">",">","len","(","dataset",")","4","Here","'s","an","example","with","both","datapoints","and","labels",">",">",">","import","deepchem","as","dc",">",">",">","smiles","=","[","``","C","''",",","``","CC","''",",","``","CCC","''",",","``","CCCC","''","]",">",">",">","labels","=","[","1",",","0",",","1",",","0","]",">",">",">","featurizer","=","dc.feat.CircularFingerprint","(",")",">",">",">","loader","=","dc.data.InMemoryLoader","(","tasks=","[","``","task1","''","]",",","featurizer=featurizer",")",">",">",">","dataset","=","loader.create_dataset","(","zip","(","smiles",",","labels",")",",","shard_size=2",")",">",">",">","len","(","dataset",")","4","Here","'s","an","example","with","datapoints",",","labels",",","weights","and","ids","all","provided",".",">",">",">","import","deepchem","as","dc",">",">",">","smiles","=","[","``","C","''",",","``","CC","''",",","``","CCC","''",",","``","CCCC","''","]",">",">",">","labels","=","[","1",",","0",",","1",",","0","]",">",">",">","weights","=","[","1.5",",","0",",","1.5",",","0","]",">",">",">","ids","=","[","``","C","''",",","``","CC","''",",","``","CCC","''",",","``","CCCC","''","]",">",">",">","featurizer","=","dc.feat.CircularFingerprint","(",")",">",">",">","loader","=","dc.data.InMemoryLoader","(","tasks=","[","``","task1","''","]",",","featurizer=featurizer",")",">",">",">","dataset","=","loader.create_dataset","(","zip","(","smiles",",","labels",",","weights",",","ids",")",",","shard_size=2",")",">",">",">","len","(","dataset",")","4"]
docstr: Break up input into shards.
  
  Parameters
  ----------
  inputs: List
      Each entry in this list must be of the form `(featurization_input,
      label, weight, id)` or `(featurization_input, label, weight)` or
      `(featurization_input, label)` or `featurization_input` for one
      datapoint, where `featurization_input` is any input that is recognized
      by `self.featurizer`.
  shard_size: int, optional
      The size of shard to generate.
  
  Returns
  -------
  Iterator[pd.DataFrame]
      Iterator which iterates over shards of data.
docstr_tok: ["Break","up","input","into","shards",".","Parameters","--","--","--","--","--","inputs",":","List","Each","entry","in","this","list","must","be","of","the","form","`","(","featurization_input",",","label",",","weight",",","id",")","`","or","`","(","featurization_input",",","label",",","weight",")","`","or","`","(","featurization_input",",","label",")","`","or","`","featurization_input","`","for","one","datapoint",",","where","`","featurization_input","`","is","any","input","that","is","recognized","by","`","self.featurizer","`",".","shard_size",":","int",",","optional","The","size","of","shard","to","generate",".","Returns","--","--","--","-","Iterator","[","pd.DataFrame","]","Iterator","which","iterates","over","shards","of","data","."]
code: def _get_shards(
      self, inputs: List, shard_size: Optional[int]
  ) -> Iterator[pd.DataFrame]:
      """Break up input into shards.
  
      Parameters
      ----------
      inputs: List
          Each entry in this list must be of the form `(featurization_input,
          label, weight, id)` or `(featurization_input, label, weight)` or
          `(featurization_input, label)` or `featurization_input` for one
          datapoint, where `featurization_input` is any input that is recognized
          by `self.featurizer`.
      shard_size: int, optional
          The size of shard to generate.
  
      Returns
      -------
      Iterator[pd.DataFrame]
          Iterator which iterates over shards of data.
      """
      current_shard: List = []
      for i, datapoint in enumerate(inputs):
          if i != 0 and shard_size is not None and i % shard_size == 0:
              shard_data = current_shard
              current_shard = []
              yield shard_data
          current_shard.append(datapoint)
      yield current_shard
  
imports: import os
  import tempfile
  import zipfile
  import time
  import logging
  import warnings
  from typing import List, Optional, Tuple, Any, Sequence, Union, Iterator
  import pandas
  import numpy
  from deepchem.utils.typing import OneOrMany
  from deepchem.utils.data_utils import load_image_files, load_csv_files, load_json_files, load_sdf_files, unzip_file
  from deepchem.feat import UserDefinedFeaturizer, Featurizer
  from deepchem.data import Dataset, DiskDataset, NumpyDataset, ImageDataset
  from deepchem.feat.molecule_featurizers import OneHotFeaturizer
  from deepchem.utils.genomics_utils import encode_bio_sequence
label_desc: Use image node_id 2 for calling the InMemoryLoader obj's underlying member method code with example usage: obj._get_shards(inputs, shard_size) without return types