liveBook · Manning

Foundational model

As explained in Deep Learning with PyTorch, Second Edition

A neural network already trained on prior data and reused for inference or further training.

A foundational model starts with training already behind it. Its learned weights can be loaded and used on new data instead of training a network from scratch. Running it on new data is called inference. Some pretrained models serve a particular task, such as image classification; a model described as foundational is useful across a broader range of inputs or tasks. section 2.7 section 15.3.1

Two practical starting points show the range:

  • For image recognition, load a model such as AlexNet through TorchVision with pretrained weights, feed it an image, and inspect its predicted labels. Its training data included labeled ImageNet images. section 2.1 section 2.1.1
  • For segmentation, Segment Anything can produce object masks from an image and accept points, boxes, or masks as prompts. Its zero-shot use does not require training on each new dataset; CT nodule segmentation is one application. section 15.3.1

The architecture and the weights are different things. TorchVision supplies model architectures and access to pretrained weights. A saved PyTorch state dictionary contains parameters, not the model’s structure: loading one requires an instance of the corresponding model class. Further training is also possible; one exercise fine-tunes a pretrained Vision Transformer on CIFAR-10. section 2.1.1 section 8.4.2 section 9.11

How Deep Learning with PyTorch, Second Edition covers it

How deep it goes
Defines pretrained weights and inference, contrasts task-specific recognition with zero-shot segmentation, and leaves Vision Transformer fine-tuning as an exercise.
Examples
Uses AlexNet image labels, Segment Anything object masks, and a pretrained Vision Transformer fine-tuning exercise.
What it assumes
Assumes PyTorch is set up for the code examples while introducing pretrained inference before deeper model construction.
What you can do after
Apply it via TorchVision for image recognition or use Segment Anything for zero-shot image segmentation.
How it connects
Connects model weights, inference, image classification, fine-tuning, and zero-shot segmentation.

Also explained in

Compare how 21 books explain foundational model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with PyTorch, Second Edition. The section links point to the parts of the book it draws on.