LogoLogo
API ReferenceGitHubSlackService StatusLogin
v3.1.1
v3.1.1
  • Deep Lake Docs
  • List of ML Datasets
  • Quickstart
  • Dataset Visualization
  • Storage & Credentials
    • Storage Options
    • Managed Credentials
      • Enabling CORS
      • Provisioning Role-Based Access
  • API Reference
  • Enterprise Features
    • Querying Datasets
      • Sampling Datasets
    • Performant Dataloader
  • EXAMPLE CODE
  • Getting Started
    • Step 1: Hello World
    • Step 2: Creating Deep Lake Datasets
    • Step 3: Understanding Compression
    • Step 4: Accessing Data
    • Step 5: Visualizing Datasets
    • Step 6: Using Activeloop Storage
    • Step 7: Connecting Deep Lake Datasets to ML Frameworks
    • Step 8: Parallel Computing
    • Step 9: Dataset Version Control
    • Step 10: Dataset Filtering
  • Tutorials (w Colab)
    • Creating Datasets
      • Creating Complex Datasets
      • Creating Object Detection Datasets
      • Creating Time-Series Datasets
      • Creating Datasets with Sequences
      • Creating Video Datasets
    • Training Models
      • Training an Image Classification Model in PyTorch
      • Training Models Using MMDetection
      • Training on AWS SageMaker Using Deep Lake Datasets
      • Training an Object Detection and Segmentation Model in PyTorch
    • Data Processing Using Parallel Computing
  • Playbooks
    • Querying, Training and Editing Datasets with Data Lineage
    • Evaluating Model Performance
    • Training Reproducibility Using Deep Lake and Weights & Biases
    • Working with Videos
  • API Summary
  • How Deep Lake Works
    • Data Layout
    • Version Control and Querying
    • Tensor Relationships
    • Visualizer Integration
    • Shuffling in ds.pytorch()
    • Storage Synchronization
    • How to Contribute
Powered by GitBook
On this page
  • How Deep Lake Datasets are Synchronized with Long-Term Storage
  • BAD PRACTICE - Code without with context
  • Code using with context

Was this helpful?

  1. How Deep Lake Works

Storage Synchronization

Synchronizing data with long-term storage and achieving optimal performance using Deep Lake.

How Deep Lake Datasets are Synchronized with Long-Term Storage

Using with context when updating Deep Lake datasets is critical for achieving rapid write performance.

BAD PRACTICE - Code without with context

By default, any standalone update to a Deep Lake dataset is immediately pushed to the dataset's long-term storage location. Due to the sheer number of discreet write operations, there may be a significant increase in runtime, especially when the data is stored in the cloud. In the example below, an update is pushed to storage for every call to the .append() command.

for i in range(10):
    ds.my_tensor.append(i)

Code using with context

To reduce the runtime when using Deep Lake, the with syntax below significantly improves performance because it only pushes updates to long-term storage after the code block inside the with statement has been executed, or when the local cache is full. This significantly reduces the number of discreet write operations, thereby increasing the speed by up to 100X.

with ds:
    for i in range(10):
        ds.my_tensor.append(i)
PreviousShuffling in ds.pytorch()NextHow to Contribute

Last updated 2 years ago

Was this helpful?