class_docstr: Writes given dataset into FFCV format (.beton).
  Supports indexable objects (e.g., PyTorch Datasets) and webdataset.
  
  Parameters
  ----------
  fname: str
      File name to store dataset in FFCV format (.beton)
  fields : Mapping[str, Field]
      Map from keys to Field's (order matters!)
  page_size : int
      Page size used internally
  num_workers : int
      Number of processes to use
docstr: Read from webdataset-like format.
  See https://docs.ffcv.io/writing_datasets.html#webdataset for sample usage.
  
  Parameters
  ----------
  shards: List[str]
      List of shards that comprise the dataset folder.
  pipeline: Callable
      Called by each worker to decode. Similar to pipelines used to load webdataset.
docstr_tok: ["Read","from","webdataset-like","format",".","See","https",":","\/\/docs.ffcv.io\/writing_datasets.html","#","webdataset","for","sample","usage",".","Parameters","--","--","--","--","--","shards",":","List","[","str","]","List","of","shards","that","comprise","the","dataset","folder",".","pipeline",":","Callable","Called","by","each","worker","to","decode",".","Similar","to","pipelines","used","to","load","webdataset","."]
code: def from_webdataset(self, shards: List[str], pipeline: Callable):
      """Read from webdataset-like format.
      See https://docs.ffcv.io/writing_datasets.html#webdataset for sample usage.
  
      Parameters
      ----------
      shards: List[str]
          List of shards that comprise the dataset folder.
      pipeline: Callable
          Called by each worker to decode. Similar to pipelines used to load webdataset.
      """
      counter = partial(count_samples_in_shard, pipeline=pipeline)
      lengths = thread_map(
          counter, shards, max_workers=self.num_workers
      )
      total_len = sum(lengths)
  
      offsets = np.cumsum([0] + lengths)[:-1]
  
      todos = zip(shards, offsets)
      self._write_common(
          total_len, todos, worker_job_webdataset, (pipeline,)
      )
  
imports: from functools import partial
  from typing import Callable, List, Mapping
  from os import SEEK_END, path
  import numpy
  from time import sleep
  import ctypes
  from multiprocessing import shared_memory, cpu_count, Queue, Process, Value
  from tqdm import tqdm
  from tqdm.contrib.concurrent import thread_map
  from .utils import chunks, is_power_of_2
  from .fields.base import Field
  from .memory_allocator import MemoryAllocator
  from .types import TYPE_ID_HANDLER, get_metadata_type, HeaderType, FieldDescType, CURRENT_VERSION, ALLOC_TABLE_TYPE
label_desc: Use image node_id 5 for calling the DatasetWriter obj's underlying member method code with example usage: obj.from_webdataset(shards, pipeline) without return types