4D Training & Consultancy

Software Development

Deep Learning with Python and PyTorch

For engineers who need to train neural networks rather than call a hosted API. The programme covers tensors and autograd, custom nn.Module architectures, the training loop and its failure signatures, regularisation and optimisation, transfer learning for vision and text, mixed precision, and export to a served runtime.

5 daysIn-house, online, or customized deliveryCorporate teams and professional groupsLevel: Advanced

Overview

Practical learning for workplace transfer.

Deep learning projects usually stall in the same place: the loss goes to NaN, the validation curve separates from training after two epochs, the GPU sits idle while the data loader starves it, or a model that scored well in a notebook cannot be exported. These are engineering problems with known signatures, and this course teaches participants to read them. Starting from the computation graph and what autograd records, it works through weight initialisation, learning-rate schedules, normalisation and dropout, gradient clipping, and the profiling that shows whether the bottleneck is compute, memory, or I/O. Transfer learning is covered as the realistic path without large labelled corpora.

Prerequisites

Strong Python skills, prior exposure to supervised machine learning, and comfort with linear algebra notation.

Objectives

  • Manipulate tensors and reason about autograd, gradients, and the computation graph.
  • Implement custom architectures with nn.Module, loss functions, and optimisers.
  • Write efficient Dataset and DataLoader code that keeps the accelerator busy.
  • Diagnose exploding loss, overfitting, and dead training runs from their signatures.
  • Fine-tune pretrained vision and language models on a limited labelled dataset.
  • Export a trained model to TorchScript or ONNX and measure inference latency.

Target audience

  • Machine learning engineers taking a model from prototype to service
  • Data scientists experienced with scikit-learn moving into neural networks
  • Computer vision engineers working on inspection, safety, or imaging tasks
  • NLP practitioners fine-tuning transformer models on domain text
  • R&D and simulation engineers replacing costly models with learned surrogates
  • Platform engineers responsible for GPU workloads and inference cost

Program outline

A clear structure for the learning journey.

Program outline

Outline points are grouped in one designed block instead of being treated as separate module cards.

Module 1: Tensors, Autograd, and the Computation Graph

Tensor creation, dtype, device placement, broadcasting, and in-place operations

requires_grad, backward, and what the graph retains between iterations

torch.no_grad, detach, and the memory leaks caused by keeping graph references

Manual gradient checks to verify a custom operation before training on it

Module 2: Building Models with nn.Module

Layers, parameters, buffers, and the forward method contract

Dense, convolutional, recurrent, and attention blocks and where each applies

Weight initialisation schemes and their effect on early training stability

Choosing a loss function that matches the task and the label encoding

Module 3: Data Loading and the Training Loop

Custom Dataset classes, transforms, and augmentation pipelines

DataLoader workers, pin_memory, prefetching, and diagnosing input starvation

The canonical loop: zero_grad, forward, loss, backward, step, and evaluate

Checkpointing, resuming, seeding, and making a run reproducible

Module 4: Optimisation, Regularisation, and Debugging

SGD with momentum, Adam, and AdamW compared on convergence behaviour

Learning-rate finders, warmup, cosine and step schedules

Dropout, weight decay, batch and layer normalisation, and early stopping

Reading NaN loss, vanishing and exploding gradients, and clipping correctly

Module 5: Transfer Learning for Vision and Text

Freezing, partial unfreezing, and discriminative learning rates by layer

Fine-tuning torchvision backbones for classification, detection, and segmentation

Adapting Hugging Face transformer models to domain text and Arabic corpora

Parameter-efficient fine-tuning with LoRA and adapter layers

Module 6: Performance, Export, and Serving

Mixed precision with autocast and GradScaler, and gradient accumulation

Profiling with torch.profiler to separate compute, memory, and I/O bottlenecks

Multi-GPU training with DistributedDataParallel and its correctness pitfalls

TorchScript and ONNX export, quantisation, and latency benchmarking

Materials provided

  • Course workbook, annotated code samples, and reference notes
  • Hands-on lab environment and starter repositories
  • Exercises, checklists, and reusable code templates
  • 4D Certificate of Completion
  • Post-course technical guidance

Training Options

Programs can be delivered in-house, online, or in a blended format depending on your team's schedule, location, and learning objectives. When an external certificate or exam is included, certification rules and fees remain under the relevant awarding body's policies, while 4D provides the training and preparation support.

Why choose 4D

4D scopes this course to hardware you actually have. Trainers benchmark your GPU or cloud instance on day one, size the architecture and batch strategy to that budget, and work on your own images, sensor traces, or Arabic and English text rather than a public benchmark set. The closing session produces an exported model with measured latency and a documented retraining path.

Speak to 4D

Plan the right training or consultancy path for your team.

Share a few details and 4D will help route your inquiry toward corporate training, consultancy, assessment, Phoenix-enabled support, or a tailored program.