Skip to content

datalayer/examples

Repository files navigation

Datalayer

Become a Sponsor

☰ Datalayer Examples

Examples for the modern Datalayer platform: managed agents for data analysis with governed execution, durable runtimes, and reproducible outputs.

Use this repository to explore:

  1. Notebook-based AI and ML workflows on CPU/GPU
  2. CLI-first remote execution and Ray job orchestration
  3. Agent-oriented prompt workflows (MCP, Skills, Guardrails...)

Read more on datalayer.ai and in the documentation.

Getting Started

pip install datalayer
git clone https://github.com/datalayer/examples.git datalayer-examples
cd datalayer-examples
jupyter lab

You can run existing notebooks as-is, then attach local or remote runtimes from JupyterLab.

Notebook remote execution

Example Catalog

  1. GPU checks
  2. PyTorch examples
  3. LLM with CPU vs GPU performance comparison
  4. GPU/CPU execution performance comparison
  5. OpenCV Face Detection
  6. Image Classifier with fast.ai
  7. Dreambooth
  8. Text Generation with Transformers
  9. Sentiment Analysis with Gemma
  10. Mistral Instruction Tuning
  11. LLM Inference with llama.cpp + LangChain
  12. Prompt examples for Jupyter MCP
  13. Ray CLI examples (datalayer ray)
  14. Evals SDK examples (batch + interactive)

Highlight: PyTorch Examples

The pytorch folder includes practical PyTorch baselines, starting with matrix multiplication for CPU/GPU throughput analysis.

It is useful to:

  1. validate runtime and CUDA readiness
  2. compare CPU and GPU execution characteristics on your setup
  3. establish reproducible performance baselines before model training or inference experiments

Ray CLI Examples

The ray folder contains Python scripts designed to be submitted with the Datalayer Ray CLI (datalayer ray jobs submit --py @...).

Included examples:

  1. hello_ray.py: basic distributed map (square) with Ray tasks
  2. pi_monte_carlo.py: distributed Monte Carlo estimation of pi
  3. actor_counter.py: stateful actor pattern with multiple counters

Evals SDK Examples

The evals folder contains SDK examples for both run modes:

  1. evals_batch_example.py: deterministic case-set execution (run_mode=batch)
  2. evals_interactive_example.py: event/live-window evaluation (run_mode=interactive)

Run them with the packaged make targets:

cd evals
make help
make evals-batch-local
make evals-batch-cloud
make evals-interactive-local
make evals-interactive-cloud
make evals-batch-local-proxy
make evals-interactive-local-proxy

CLI

Datalayer supports remote code execution through the CLI and integrates with managed runtimes and Ray workflows.

See CLI docs and the Ray examples for end-to-end commands.

CLI Remote Execution CLI remote execution
Sharing State between Notebook and CLI Remote Notebook Execution

When using the same Kernel, variables defined in a notebook can be reused in the CLI and vice versa.

JupyterLab

Datalayer supports cell-specific runtimes so you can run specific cells on different compute targets.

This lets you optimize cost and performance, for example by using local CPU for data prep and remote GPU for intensive cells.

Cell runtime execution Cell Runtime Execution

The remote GPU runtime is used only for the duration of selected cell computation.

About

☰ Examples for Datalayer.

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

 

Contributors

Languages