100% found this document useful (2 votes)
23 views

Deep Learning at Scale At the Intersection of Hardware Software and Data 1st Edition Suneeta Mall download

The document is a detailed overview of the book 'Deep Learning at Scale' by Suneeta Mall, which focuses on the integration of hardware, software, and data for scaling deep learning projects. It covers foundational concepts, computational aspects, and distributed training techniques, providing practical exercises and insights for both novice and experienced practitioners. The book aims to equip readers with the necessary tools and techniques to effectively scale their deep learning models in production environments.

Uploaded by

majorstistis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
23 views

Deep Learning at Scale At the Intersection of Hardware Software and Data 1st Edition Suneeta Mall download

The document is a detailed overview of the book 'Deep Learning at Scale' by Suneeta Mall, which focuses on the integration of hardware, software, and data for scaling deep learning projects. It covers foundational concepts, computational aspects, and distributed training techniques, providing practical exercises and insights for both novice and experienced practitioners. The book aims to equip readers with the necessary tools and techniques to effectively scale their deep learning models in production environments.

Uploaded by

majorstistis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Deep Learning at Scale At the Intersection of

Hardware Software and Data 1st Edition Suneeta


Mall pdf download

https://ebookfinal.com/download/deep-learning-at-scale-at-the-
intersection-of-hardware-software-and-data-1st-edition-suneeta-
mall/

Explore and download more ebooks or textbooks


at ebookfinal.com
Here are some recommended products for you. Click the link to
download, or explore more at ebookfinal

Levinas and Education At the Intersection of Faith and


Reason 1st Edition Denise Egéa-Kuehne

https://ebookfinal.com/download/levinas-and-education-at-the-
intersection-of-faith-and-reason-1st-edition-denise-egea-kuehne/

Data Scientists at Work 1st Edition Sebastian Gutierrez

https://ebookfinal.com/download/data-scientists-at-work-1st-edition-
sebastian-gutierrez/

Effective DevOps Building a Culture of Collaboration


Affinity and Tooling at Scale 1st Edition Jennifer Davis

https://ebookfinal.com/download/effective-devops-building-a-culture-
of-collaboration-affinity-and-tooling-at-scale-1st-edition-jennifer-
davis/

The Effect of Riparian Zones on Nitrate Removal by


Denitrification at the River Basin Scale 1st Edition
Nguyen
https://ebookfinal.com/download/the-effect-of-riparian-zones-on-
nitrate-removal-by-denitrification-at-the-river-basin-scale-1st-
edition-nguyen/
The Vices of Learning Morality and Knowledge at Early
Modern Universities 1st Edition Sari Kivistö

https://ebookfinal.com/download/the-vices-of-learning-morality-and-
knowledge-at-early-modern-universities-1st-edition-sari-kivisto/

Learning At Work How to Support Individual and


Organizational Learning 3rd Edition Bridgett O'Conner

https://ebookfinal.com/download/learning-at-work-how-to-support-
individual-and-organizational-learning-3rd-edition-bridgett-oconner/

Black Hat physical device security exploiting hardware and


software 1st Edition Drew Miller

https://ebookfinal.com/download/black-hat-physical-device-security-
exploiting-hardware-and-software-1st-edition-drew-miller/

Learn Hardware Firmware and Software Design 2nd edition


Edition O G Popa

https://ebookfinal.com/download/learn-hardware-firmware-and-software-
design-2nd-edition-edition-o-g-popa/

Deep Learning for Finance Creating Machine Deep Learning


Models for Trading in Python 1st Edition Kaabar

https://ebookfinal.com/download/deep-learning-for-finance-creating-
machine-deep-learning-models-for-trading-in-python-1st-edition-kaabar/
Deep Learning at Scale At the Intersection of Hardware
Software and Data 1st Edition Suneeta Mall Digital
Instant Download
Author(s): Suneeta Mall
ISBN(s): 9781098145286, 1098145283
Edition: 1
File Details: PDF, 20.80 MB
Year: 2024
Language: english
Deep Learning at Scale “A new paradigm is
Bringing a deep learning project into production at scale emerging, one where our
is quite challenging. To successfully scale your project, you programs are written on
require a foundational understanding of the deep learning distributed architectures
stack—specifically, how deep learning interfaces with through data. This requires
hardware, software, and data. a change of approach and
Ideal for anyone interested in model development at scale, a new set of challenges:
this book illustrates complex concepts of the deep learning leveraging data to do
stack and reinforces them through practical exercises. our bidding while facing
Author Suneeta Mall explains the intricate concepts, tools, the challenges arising
and techniques to help you scale your deep learning model from distributed
development and training workload effectively and efficiently. computing. This book
Topics include:
offers a comprehensive
overview of what this
• How your model is decomposed into a computation entails, making it an
graph and how your data flows through this graph interesting starting point
during the training process
for less experienced
• How accelerated computing speeds up your training practitioners and a great
and how you can best utilize the hardware resources reference for experts.”
at your disposal —Giovanni Alzetta, PhD
• How to train your model using distributed training Machine Learning Engineer
at Oramasearch
paradigms (e.g., data, model, pipeline, and hybrid
multidimensional parallelism)
• Debugging, monitoring, and investigating bottlenecks Suneeta Mall is head of the AI
that undesirably slow down the scale out of model training Engineering Division at harrison.ai,
a clinician-led artificial intelligence
• How to expedite the training lifecycle and streamline
medical technology company focused
your feedback loop to iterate model development
on addressing significant healthcare
and other related tricks, tools, and techniques to
issues. She has a strong computer
scale your training workload science and engineering background
• How to apply data-centric techniques to efficiently through her roles at IBM, Expedia,
train your model at scale USyd, Nearmap, and harrison.ai.

DATA linkedin.com/company/oreilly-media
youtube.com/oreillymedia
US $79.99 CAN $99.99
ISBN: 978-1-098-14528-6
57999

9 781098 145286
Deep Learning at Scale
At the Intersection of Hardware, Software,
and Data

Suneeta Mall

Beijing Boston Farnham Sebastopol Tokyo


Deep Learning at Scale
by Suneeta Mall
Copyright © 2024 Suneeta Mall. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (https://oreilly.com). For more information, contact our corporate/institu‐
tional sales department: 800-998-9938 or corporate@oreilly.com.

Acquisition Editor: Nicole Butterfield Copyeditor: Rachel Head


Development Editor: Sara Hunter Proofreader: Kim Cofer
Production Editor: Aleeya Rahman Indexer: Judith McConville
Interior Designer: David Futato
Cover Designer: Karen Montgomery
Illustrator: Kate Dullea

June 2024: First Edition

Revision History for the First Edition


2024-06-17: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781098145286 for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Deep Learning at Scale, the cover
image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the author and do not represent the publisher’s views.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.

978-1-098-14528-6
[LSI]
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

1. What Nature and History Have Taught Us About Scale. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


The Philosophy of Scaling 1
The General Law of Scaling 2
History of Scaling Law 2
Scalable Systems 4
Nature as a Scalable System 5
Our Visual System: A Biological Inspiration 6
Artificial Intelligence: The Evolution of Learnable Systems 7
It Takes Four to Tango 7
Evolving Deep Learning Trends 16
Scale in the Context of Deep Learning 21
Six Development Considerations 22
Scaling Considerations 26
Summary 33

Part I. Foundational Concepts of Deep Learning


2. Deep Learning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
The Role of Data in Deep Learning 37
Data Flow in Deep Learning 39
Hands-On Exercise #1: Implementing Minimalistic Deep Learning 42
Developing the Model 43
The Embedded/Latent Space 49
A Word of Caution 51
The Learning Rate and Loss Landscape 52

iii
Scaling Consideration 54
Profiling 55
Hands-On Exercise #2: Getting Complex with PyTorch 57
Model Input Data and Pipeline 58
Model 59
Auxiliary Utilities 60
Putting It All Together 62
Computation Graphs 63
Inference 66
Summary 67

3. The Computational Side of Deep Learning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69


The Higgs Boson of the Digital World 70
Floating-Point Numbers: The Faux Continuous Numbers 70
Units of Data Measurement 74
Data Storage Formats: The Trade-off of Latency and Throughput 75
Computer Architecture 75
The Birth of the Electromechanical Engine 76
Memory and Persistence 77
Computation and Memory Combined 81
The Scaling Laws of Electronics 83
Scaling Out Computation with Parallelization 85
Threads Versus Processes: The Unit of Parallelization 85
Hardware-Optimized Libraries for Acceleration 90
Parallel Computer Architectures: Flynn’s and Duncan’s Taxonomies 90
Accelerated Computing 91
Popular Accelerated Devices for Deep Learning 93
CUDA 100
Accelerator Benchmarking 112
Summary 112

4. Putting It All Together: Efficient Deep Learning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113


Hands-On Exercise #1: GPT-2 114
Exercise Objectives 114
Model Architecture 115
Implementation 118
Running the Example 119
Experiment Tracking 120
Measuring to Understand the Limitations and Scale Out 121
Transitioning from Language to Vision 127
Hands-On Exercise #2: Vision Model with Convolution 128
Model Architecture 128

iv | Table of Contents
Running the Example 132
Observations 132
Graph Compilation Using PyTorch 2.0 132
New Components of PyTorch 2.0 133
Graph Execution in PyTorch 2.0 134
Modeling Techniques to Scale Training on a Single Device 136
Graph Compilation 136
Reduced- and Mixed-Precision Training 138
Memory Tricks for Efficiency 142
Optimizer Efficiencies 144
Model Input Pipeline Tricks 148
Writing Custom Kernels in PyTorch 2.0 with Triton 148
Summary 149

Part II. Distributed Training


5. Distributed Systems and Communications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Distributed Systems 154
The Eight Fallacies of Distributed Computing 155
The Consistency, Availability, and Partition Tolerance (CAP) Theorem 156
The Scaling Law of Distributed Systems 157
Types of Distributed Systems 159
Communication in Distributed Systems 162
Communication Paradigm 162
Communication Patterns 163
Communication Technologies 167
MPI 169
Communication Initialization: Rendezvous 172
Hands-On Exercise 173
Scaling Compute Capacity 173
Infrastructure Setup Options 173
Provisioning of Accelerated Devices 176
Workload Management 178
Deep Learning Infrastructure Review 185
Overview of Leading Deep Learning Clusters 185
Similarities Between Today’s Most Powerful Systems 188
Summary 189

6. Theoretical Foundations of Distributed Deep Learning. . . . . . . . . . . . . . . . . . . . . . . . . 191


Distributed Deep Learning 191
Centralized DDL 192

Table of Contents | v
Decentralized DDL 199
Dimensions of Scaling Distributed Deep Learning 207
Partitioning Dimensions of Distributed Deep Learning 207
Types of Distributed Deep Learning Techniques 208
Choosing a Scaling Technique 218
Measuring Scale 220
End-to-End Metrics and Benchmarks 221
Measuring Incrementally in a Reproducible Environment 226
Summary 227

7. Data Parallelism. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229


Data Partitioning 229
Implications of Data Sampling Strategies 231
Working with Remote Datasets 231
Introduction to Data Parallel Techniques 232
Hands-On Exercise #1: Centralized Parameter Server Using RCP 232
Hands-On Exercise #2: Centralized Gradient-Partitioned Joint Worker/
Server Distributed Training 236
Hands-On Exercise #3: Decentralized Asynchronous Distributed Training 238
Centralized Synchronous Data Parallel Strategies 240
Data Parallel (DP) 242
Distributed Data Parallel (DDP) 242
Zero Redundancy Optimizer–Powered Data Parallelism (ZeRO-DP) 244
Fault-Tolerant Training 246
Hands-On Exercise #4: Scene Parsing with DDP 247
Hands-On Exercise #5: Distributed Sharded DDP (ZeRO) 251
Building Efficient Pipelines 253
Dataset Format 253
Local Versus Remote 254
Staging 254
Threads Versus Processes: Scaling Your Pipelines 255
Memory Tricks 255
Data Augmentations: CPU Versus GPU 255
JIT Acceleration 255
Hands-On Exercise #6: Pipeline Efficiency with FFCV 256
Summary 257

8. Scaling Beyond Data Parallelism: Model, Pipeline, Tensor, and Hybrid Parallelism. 259
Questions to Ask Before Scaling Vertically 261
Theoretical Foundations of Vertical Scaling 264
Revisiting the Dimensions of Scaling 265
Operators’ Perspective of Parallelism Dimensions 271

vi | Table of Contents
Data Flow and Communications in Vertical Scaling 271
Basic Building Blocks for Scaling Beyond DP 284
PyTorch Primitives for Vertical Scaling 284
Working with Larger Models 287
Distributed Checkpointing: Saving the Partitioned Model 288
Summary 289

9. Gaining Practical Expertise with Scaling Across All Dimensions. . . . . . . . . . . . . . . . . . 291


Hands-On Exercises: Model, Tensor, Pipeline, and Hybrid Parallelism 291
The Dataset 291
Hands-On Exercise #1: Baseline DeepFM 292
Hands-On Exercise #2: Model Parallel DeepFM 293
Hands-On Exercise #3: Pipeline Parallel DeepFM 296
Hands-On Exercise #4: Pipeline Parallel DeepFM with RPC 297
Hands-On Exercise #5: Tensor Parallel DeepFM 298
Hands-On Exercise #6: Hybrid Parallel DeepFM 300
Tools and Libraries for Vertical Scaling 301
OneFlow 301
FairScale 302
DeepSpeed 302
FSDP 305
Overview and Comparison 305
Hands-On Exercise #7: Automatic Vertical Scaling with DeepSpeed 307
Observations 307
Summary 308

Part III. Extreme Scaling


10. Data-Centric Scaling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
The Seven Vs of Data Through a Deep Learning Lens 312
The Scaling Law of Data 313
Data Quality 316
Validity 317
Variety 317
Veracity 332
Value and Volume 340
The Data Engine and Continual Learning 346
Volatility 347
Velocity 348
Summary 348

Table of Contents | vii


11. Scaling Experiments: Effective Planning and Management. . . . . . . . . . . . . . . . . . . . . 349
Model Development Is Iterative 350
Planning for Experiments and Execution 351
Simplify the Complex 351
Fast Iteration for Fast Feedback 352
Decoupled Iterations 352
Feasibility Testing 353
Developing and Scaling a Minimal Viable Solution 353
Setting Up for Iterative Execution 354
Techniques to Scale Your Experiments 357
Accelerating Model Convergence 358
Accelerating Learning Via Optimization and Automation 362
Accelerating Learning by Increasing Expertise 372
Learning with Scarce Supervision 380
Hands-On Exercises 382
Hands-On Exercise #1: Transfer Learning 383
Hands-On Exercise #2: Hyperparameter Optimization 383
Hands-On Exercise #3: Knowledge Distillation 384
Hands-On Exercise #4: Mixture of Experts 386
Hands-On Exercise #5: Contrastive Learning 388
Hands-On Exercise #6: Meta-Learning 389
Summary 389

12. Efficient Fine-Tuning of Large Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391


Review of Fine-Tuning Techniques 392
Standard Fine Tuning 392
Meta-Learning (Zero-/Few-Shot Learning) 393
Adapter-Based Fine Tuning 393
Low-Rank Tuning 394
LoRA—Parameter-Efficient Fine Tuning 395
Quantized LoRA (QLoRA) 396
Hands-on Exercise: QLoRA-Based Fine Tuning 397
Implementation Details 397
Inference 398
Exercise Summary 399
Summary 399

13. Foundation Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401


What Are Foundation Models? 401
The Evolution of Foundation Models 402
Challenges Involved in Developing Foundation Models 406
Measurement Complexity 406

viii | Table of Contents


Deployment Challenges 407
Propagation of Defects to All Downstream Models 407
Legal and Ethical Considerations 407
Ensuring Consistency and Coherency 408
Multimodal Large Language Models 408
Projection 409
Gated Cross-Attention 410
Query-Based Encoding 411
Further Exploration 412
Summary 412

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

Table of Contents | ix
Preface

I started my professional career as a software engineer. Over the course of my time in


that role, I became deeply interested and involved in running software and systems at
scale. I learned a lot about distributed systems, performance, optimizations, and run‐
ning them reliably at scale. Subsequently, I went on to perform many other roles,
from building systems at the intersection of software and operations (DevOps) and
auxiliary systems to enable intelligent software (MLOps), to running deep learning
inference at scale and developing data engines for deep learning (machine learning
engineering), to developing multitasking, multiobjective models for critical functions
such as healthcare and business decision workflows as a data scientist and machine
learning specialist.
Since I’ve become involved in building intelligent systems, deep learning is a big part
of what I do today. The wide adoption of deep learning–based intelligent (AI) sys‐
tems is motivated by its ability to solve problems at scale with efficiency. However,
building such systems is complex, because deep learning is not just about algorithms
and mathematics. Much of the complexity lies at the intersection of hardware, soft‐
ware, data, and deep learning (the algorithms and techniques, specifically). I consider
myself fortunate to have gained experience in a series of roles that forced me to rap‐
idly develop a detailed understanding of building and managing deep learning–based
AI systems at scale. The knowledge that I have acquired because of the opportunities
presented to me is not so easily available and consumed, because each of these
domains—hardware, software, and data—is as complex as deep learning itself.
The key motivation behind this book is to democratize this knowledge so that every
machine learning practitioner, engineer or not, can navigate the deep learning land‐
scape. I’ve always felt that this knowledge was somewhat fragmented, and saw an
opportunity to pull it together to create a coherent knowledge base. This unified
knowledge base will provide theoretical and practical guidance for developing deep
learning engineering knowledge so you can easily scale out your deep learning work‐
loads without needing to go through as many explorations as I did.

xi
Why Scaling Matters
Deep learning and scaling are correlated. Deep learning is capable of scaling your
objectives from single task to multitask, from one modality to multimodality, from
one class to thousands of classes. Anything is possible, provided you have scalable
hardware and a large volume of data and write software that can efficiently scale to
utilize all the resources available to you.
Scaling is complex, and thus not free. Developing a deep learning–based system
requires a large number of layers, a large volume of data, and hardware capable of
handling computationally intensive workloads. Scaling requires understanding the
elasticity of your entire system—not just your model but your entire deep learning
stack—and adapting to situations where elasticity nears a breaking point. Therein lies
the secondary motivation of this book: to enable you to gain a deeper understanding
of your system and when it might break, and how you can avoid unnecessary breaks.

Who This Book Is For


This book aims to help you develop a deeper knowledge of the deep learning stack—
specifically, how deep learning interfaces with hardware, software, and data. It will
serve as a valuable resource when you want to scale your deep learning model, either
by expanding the hardware resources or by adding larger volumes of data or increas‐
ing the capacity of the model itself. Efficiency is a key part of any scaling operation.
For this reason, consideration of efficiency is weaved in throughout the book, to pro‐
vide you with the knowledge and resources you need to scale effectively.
This book is written for machine learning practitioners from all walks of life: engi‐
neers, data engineers, MLOps, deep learning scientists, machine learning engineers,
and others interested in learning about model development at scale. It assumes that
the reader already has a fundamental knowledge of deep learning concepts such as
optimizers, learning objectives and loss functions, and model assembly and compila‐
tion, as well as some experience with model development. Familiarity with Python
and PyTorch is also essential for the practical sections of the book.
Given the complexity and scope, this book primarily focuses on scale-out of model
development and training, with an extensive focus on distributed training. While the
first few chapters may be useful for deployment and inference use cases, scaling infer‐
ence is beyond the scope of this book. The topics we will cover include:

• How your model is decomposed into a computation graph and how your data
flows through this graph during the training process.
• The less told but beautiful story of floating-point numbers and how these Higgs
bosons of deep learning can be used to achieve memory efficiency.

xii | Preface
• How accelerated computing speeds up your training and how you can best utilize
the hardware resources at your disposal.
• How to train your model using distributed training paradigms (i.e., data, model,
pipeline, and hybrid multidimensional parallelism). You will also learn about
federated learning and its challenges.
• How to leverage the PyTorch ecosystem in conjunction with NVIDIA libraries
and Triton to scale your model training.
• Debugging, monitoring, and investigating bottlenecks that undesirably slow
down the scale-out of model training.
• How to expedite the training lifecycle and streamline your feedback loop to iter‐
ate model development and related best practices.
• A set of data tricks and techniques and how to apply them to scale your training
over limited resources.
• How to select the right tools and techniques for your deep learning project.
• Options for managing compute infrastructure when running at scale.

How This Book Is Organized


This book consists of an introductory chapter followed by a dozen chapters divided
into three parts covering foundational concepts, distributed training, and extreme
scaling. Each chapter builds upon the concepts, fundamentals, and principles from
the preceding chapters to provide a holistic knowledge of deep learning that will
enable efficient and effective scale-out of training workloads.

Introduction
Chapter 1, “What Nature and History Have Taught Us About Scale”, sets out the the‐
oretical framework for deciding when to scale and explores the high-level challenges
involved in scaling out. In this chapter, you will also read about the history of deep
learning and how scaling has been a key driver of its success.

Part I: Foundational Concepts of Deep Learning


Chapter 2, “Deep Learning”, introduces deep learning through the lens of computa‐
tional graphs and data flow. Early-stage machine learning practitioners may find this
chapter helpful as it explains the inner workings of deep learning through pure
Python, no-frills exercises. More experienced deep learning practitioners may choose
to skip this chapter.
Chapter 3, “The Computational Side of Deep Learning”, dives into the inner work‐
ings of electronic computations and hardware, exploring how compute capabilities

Preface | xiii
are achieved and scaled. It also provides detailed insights into the variety of acceler‐
ated hardware available today, to arm you with the knowledge required to choose the
most suitable hardware for your project.
Chapter 4, “Putting It All Together: Efficient Deep Learning”, brings the foundational
knowledge of deep learning together to provide more practical guidance on how to
build an efficient and effective intelligent system for your task and how to measure
and monitor it. In this chapter, you will also learn about graph compilation and a ser‐
ies of memory tricks to provide you with the knowledge to build an efficient stack.

Part II: Distributed Training


Chapter 5, “Distributed Systems and Communications”, introduces the foundations
of distributed systems and provides detailed insights into the different types and the
challenges associated with each one. Communication is a critical aspect of distributed
systems that’s explained in this chapter through the lens of deep learning. This chap‐
ter also provides insights into the options and tools that can be used to scale out your
hardware resources to achieve distributed computing, along with what this means for
hardware with acceleration.
Chapter 6, “Theoretical Foundations of Distributed Deep Learning”, extends Chap‐
ter 5 to provide theoretical and foundational knowledge of distributed deep learning.
In this chapter, you will learn about a variety of distributed deep learning training
techniques and a framework for choosing one.
Chapter 7, “Data Parallelism”, dives into the details of distributed data parallelism
and provides a series of practical exercises demonstrating these techniques.
Chapter 8, “Scaling Beyond Data Parallelism: Model, Pipeline, Tensor, and Hybrid
Parallelism”, provides foundational and practical knowledge of scaling model train‐
ing beyond data parallel. In this chapter, you will learn about model, pipeline, and
multidimensional hybrid parallelism and experience the challenges and limitations of
each of these techniques via practical exercises.
Chapter 9, “Gaining Practical Expertise with Scaling Across All Dimensions”, brings
all the learning of Part II together to provide knowledge and insights on how to real‐
ize multidimensional parallelism in a more effective manner.

Part III: Extreme Scaling


Chapter 10, “Data-Centric Scaling”, provides a data-centric perspective and offers
valuable information on assorted techniques to maximize the gain from your data.
This chapter also provides useful insights on how to achieve efficiency in your data
pipelines through sampling and selection techniques.

xiv | Preface
Chapter 11, “Scaling Experiments: Effective Planning and Management”, focuses on
scaling out of experiments and provides insights on experiment planning and man‐
agement. This chapter provides useful information for when you’re conducting mul‐
tiple experiments and want to maximize your chances of finding the best-performing
model; it covers techniques like fine tuning, mixture of experts (MoE), contrastive
learning, etc.
Chapter 12, “Efficient Fine-Tuning of Large Models”, explores low-rank fine tuning
of large models with a practical example.
Chapter 13, “Foundation Models”, lays out the conceptual framework of foundation
models and provides a summary of this evolving landscape.

What You Need to Use This Book


To run the code samples in this book, you will need a working device with at least a
16-core CPU and 16 GB (ideally 32 GB) of RAM. Most of the exercises in Part II use
accelerated hardware, so access to a system with more than one GPU—ideally NVI‐
DIA—will be required for some of the exercises. Most exercises are written in a
platform-agnostic way, and a Dockerfile with a list of runtime dependencies required
to run the exercises is provided.

Setting Up Your Environment for Hands-on Exercises


Instructions to set up your environment for this book’s practical exercises are
included in the companion GitHub repository. This page includes specific guidelines
to set up either a Python-based native environment or an emulated Docker environ‐
ment. Instructions to set up the NVIDIA drivers and CUDA runtime are also pro‐
vided, along with instructions on updating the versions and running the exercises.
Some exercises in Part II will come with special instructions that will be explained in
the context of those exercises.

Using Code Examples


Supplemental material (code examples, exercises, etc.) is available for download at
https://github.com/suneeta-mall/deep_learning_at_scale.
If you have a technical question or a problem using the code examples, please send an
email to bookquestions@oreilly.com.
This book is here to help you get your job done. In general, if example code is offered
with this book, you may use it in your programs and documentation. You do not
need to contact us for permission unless you’re reproducing a significant portion of
the code. For example, writing a program that uses several chunks of code from this

Preface | xv
book does not require permission. Selling or distributing examples from O’Reilly
books does require permission. Answering a question by citing this book and quoting
example code does not require permission. Incorporating a significant amount of
example code from this book into your product’s documentation does require per‐
mission.
We appreciate, but generally do not require, attribution. An attribution usually
includes the title, author, publisher, and ISBN. For example: “Deep Learning at Scale
by Suneeta Mall (O’Reilly). Copyright 2024 Suneeta Mall, 978-1-098-14528-6.”
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at permissions@oreilly.com.

Conventions Used in This Book


The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.

This element signifies a tip or suggestion.

This element signifies a general note.

xvi | Preface
This element indicates a warning or caution.

O’Reilly Online Learning


For more than 40 years, O’Reilly Media has provided technol‐
ogy and business training, knowledge, and insight to help
companies succeed.

Our unique network of experts and innovators share their knowledge and expertise
through books, articles, and our online learning platform. O’Reilly’s online learning
platform gives you on-demand access to live training courses, in-depth learning
paths, interactive coding environments, and a vast collection of text and video from
O’Reilly and 200+ other publishers. For more information, visit https://oreilly.com.

How to Contact Us
Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.


1005 Gravenstein Highway North
Sebastopol, CA 95472
800-889-8969 (in the United States or Canada)
707-827-7019 (international or local)
707-829-0104 (fax)
support@oreilly.com
https://www.oreilly.com/about/contact.html

We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at https://oreil.ly/DLAS.
For news and information about our books and courses, visit https://oreilly.com.
Find us on LinkedIn: https://linkedin.com/company/oreilly-media.
Watch us on YouTube: https://youtube.com/oreillymedia.

Preface | xvii
Acknowledgments
To my beloved family: Your unwavering support and understanding during the cre‐
ation of this book has been huge. My heartfelt thanks to my husband, whose patience
and encouragement kept me going. To my incredible children, your curiosity and
enthusiasm for learning inspire me every day. This book is as much yours as it is
mine.
Mum, Dad, and parents in-law, your love, wisdom, unwavering belief in my abilities,
and endless encouragement have been a guiding light throughout this journey. To
my brother, your perseverance knows no bounds and keeps me inspired. This book is
dedicated to all of you.
To the open source deep learning community: I have deepest gratitude for the open
source communities around the world that have been forthcoming with their knowl‐
edge and work to collectively and collaboratively improve the posture of AI systems
in production. Your commitment to innovation and accessibility in the field of deep
learning has been revolutionary.
The knowledge, tools, and resources that these communities have built together have
not only shaped this book, but have also transformed the landscape of machine learn‐
ing. I’m deeply thankful for your contributions. This work would not have been pos‐
sible without you. I take deep pleasure in dedicating this book to you!
To my dedicated tech reviewers and editorial team: I’m indebted to your valuable
input and dedication to excellence. I would like to acknowledge and express my
deepest gratitude to the technical reviewers, Tim Hauke Langer, Giovanni Alzetta,
Satyarth Praveen, and Vishwesh Ravi Shrimali, and my editor, Sara Hunter, whose
guidance and advice have greatly improved this book. I would also like to express my
gratitude to Nicole Butterfield, my acquisitions editor, for her support and guidance
in shaping the direction of the book.

xviii | Preface
Discovering Diverse Content Through
Random Scribd Documents
I did not fail to listen attentively to their discourse, when I heard
what follows: “I do not deserve,” said the queen to her lover, “your
reproaches for my want of diligence; you well know the reason of it;
but if all the marks of love which I have hitherto given you are not
sufficient to persuade you of my sincerity, I am ready to give you still
more convincing proofs of it; you have only to command, you know
my power. I will if you wish it, before the sun rises, change this great
city and this beautiful palace into frightful ruins, which shall be
inhabited only by wolves, and owls, and ravens. Shall I transport all
the stones, with which these walls are so strongly built, beyond
Mount Caucasus, and farther than the boundaries of the habitable
world? You have only to speak, and all this place shall be
transformed.”

As the queen finished this speech, she and her lover, having
reached the end of the walk, turned to enter another, and passed
before me; I had already drawn my scimitar, and as the lover was
next me, I struck him on the neck, and he fell. I believed I had killed
him, and with this persuasion, I retired precipitately, without
discovering myself to the queen, whom I wished to spare, as she
was my cousin.

Although her lover’s wound was mortal, she yet contrived by her
enchantments to preserve in him that kind of existence, which can
be called neither dead or alive. As I traversed the garden to return
to the palace, I heard the queen weeping bitterly, and judging of her
grief by her cries, I was not sorry to have left him alive. When I
reached my chamber I went again to bed, and feeling satisfied with
the punishment I had inflicted on the wretch who had offended me,
I fell asleep. On waking the next morning, I found the queen by my
side; I cannot say whether she was asleep or feigned it, but I got up
without disturbing her, and retired to my closet, where I finished
dressing: I afterwards attended the council; and, on my return, the
queen, dressed in mourning, her hair dishevelled and torn,
presented herself before me. “Sire,” said she, “I come to entreat
your majesty not to be displeased at the state in which you now see
me. I have just received intelligence of three events, which occasion
the grief I so strongly feel, but can ill express.”—“What are these
events, madam?” I inquired.—“The death of the queen, my beloved
mother,” replied she; “that of the king, my father, who was killed in
battle; and also of my brother, who fell down a precipice.”

I was not sorry that she had invented this pretext to conceal the
true cause of her affliction, and I imagined, that she did not suspect
me of having been the murderer of her lover. “Madam,” said I, “I do
not blame your sorrow; on the contrary, I assure you that I am not
insensible to the cause. I should be much surprised if you were not
affected by such a loss; weep, for your tears are an undoubted proof
of your good heart; I hope, nevertheless, that time and reason will
restore to you your wonted cheerfulness.”

She retired to her apartment, where, abandoning herself to her


grief, she passed a whole year in weeping and bewailing the death
of her lover. At the expiration of that time, she requested my
permission to build a mausoleum for herself in the centre of the
palace, where she said she wished to pass the remainder of her
days. I did not refuse her, and she erected a magnificent palace with
a dome, which may be seen from hence, and she called it the Palace
of Tears.

When it was finished, she had her lover removed from the place,
whither she had transported him on the night I wounded him, and
brought to this mausoleum. She had till that period preserved his life
by giving him certain potions, which she administered herself, and
continued to give him daily, after his removal to the Palace of Tears.

All her enchantments, however, did not avail, for he was not only
unable to walk or stand, but had also lost the use of his speech, and
gave no signs of life, but by looks. Although the queen had only the
consolation of seeing him and saying to him all the tender things
that her love inspired, yet she constantly paid him two long visits
every day. I was well acquainted with this circumstance, but I
pretended to be ignorant of it.

Excited by my curiosity, I went one day to the Palace of Tears, to


know what was the occupation of the princess, and concealing
myself in a part where I could see and hear what passed, I heard
her speak in this manner to her lover: “It is the heaviest affliction to
me to see you in this state; I feel as much as yourself the agonies
you endure; but, dearest life, I am always speaking to you, and yet
you return no answer: how long will this distressing silence
continue? Speak but once, and I will be satisfied. Alas! these
moments that I pass with you, endeavouring to mitigate your
sufferings, are the happiest of my life. I cannot exist away from you,
and I should willingly prefer the pleasure of seeing you continually,
to the empire of the whole universe.”

This discourse, which was frequently interrupted by tears and


sobs, at length exhausted my patience. I could no longer remain in
concealment, and approaching her, “Madam,” said I, “you have wept
enough; it is now time to have done with a grief, which dishonours
us both; you forgot what you owe to me, as well as what you owe to
yourself.”—“Sire,” replied she, “if you still retain any regard for me, I
entreat you to leave me to my sorrows, which time can neither
diminish nor relieve.”

I endeavoured, but in vain, to bring her to a sense of her duty;


and finding that all my arguments only increased her obstinacy, I at
last desisted and left her. She continued to visit her lover every day;
and for two years she was inconsolable.

I went a second time to the Palace of Tears while she was there. I
hid myself as before, and heard her say, “It is now three years that
you have not spoken to me; nor do you return the proofs of
affection and fondness which my complaints and sighs must
convince you I feel: is it from insensibility or disdain? Hast thou, O
tomb, destroyed that excess of tenderness which he bore me? Hast
thou closed for ever those dear eyes which beamed with love and
formed all my pleasure? Ah no, I cannot think it; rather let me say,
thou art become the deposit of the rarest treasure the world ever
saw.”

I avow to you, my lord, that I was enraged at these words; for in


truth this cherished lover, this adored mortal, was not at all what you
would imagine. He was a black Indian, one of the original
inhabitants of this country. I was, as I have said, so enraged at this
speech, that I suddenly shewed myself, and addressing myself in a
similar manner to the tomb, I said, “Why dost thou not, O tomb,
swallow up this monster, who is even disgusting to human nature?
or rather, why dost thou not consume both the lover and the
mistress?”

I had hardly finished these words, when the queen, who was
seated near the black, started up like a fury, “Ah, wretch!” said she
to me, “it is you who have been the cause of my grief; think not that
I am ignorant of it. I have already dissembled too long. It was your
barbarous hand which reduced the object of my affection to the
miserable state he now is in. And have you the cruelty to come and
insult my despair?” “Yes,” cried I, interrupting her, and transported
with anger, “I have chastised the monster as he deserved, and I
ought to treat thee in the same manner. I repent not having already
done it, for thou hast too long abused my goodness.” In saying this,
I drew my scimitar, and raised my arm to punish her. “Moderate thy
rage,” said she to me with a disdainful smile, and regarding my
motions with a tranquil air, and at the same instant she pronounced
some words which I did not understand, and added, “By virtue of
my enchantments, I command thee from this moment to become
half marble and half man.” Immediately, my lord, I was changed to
what you see me; already dead among the living, and living among
the dead.

As soon as this cruel enchantress, for she is unworthy of bearing


the title of queen, had thus transformed me, and by means of her
magic had conveyed me to this apartment, she destroyed my capital,
which was both flourishing and well inhabited; she annihilated the
palaces, public places, and markets; turned the whole place into a
lake, or pond, and rendered the country, as you may perceive, quite
a desert. The four sorts of fish, which are in the pond, are four
different classes of inhabitants, who professed different religions,
and inhabited the capital. The white were Musselmen; the red,
Persians, who worship fire; the blue, Christians; and the yellow,
Jews; the four little hills were four islands; whence the name of the
kingdom originated. I was informed of all this by the enchantress,
who herself related the effects of her rage. Nor was even this all;
she did not confine her fury to the destruction of my empire, and to
my enchantment, for she comes every day and gives me a hundred
blows with a thong, made of a bull’s hide, upon my shoulders, from
whence she draws blood at every stroke. As soon as she has finished
this punishment, she covers me with a thick stuff, made of goat’s
hair; and puts a robe of rich brocade over it, not for the sake of
honouring, but of mocking me.” In saying this, the young king of the
Black Isles could not refrain from tears; and the sultan’s heart was
so oppressed, he could not offer him any consolation. The young
king then, lifting up his eyes towards Heaven, exclaimed, “I submit,
O powerful Creator of all things, to thy judgments, and to the
decrees of thy providence. Since it is thy pleasure, I patiently suffer
every evil; yet I trust thy infinite goodness will one day recompense
me.”

“Inform me,” cried the sultan, affected by the recital of so strange


a story, and eager to revenge his injuries, “inform me where this
perfidious enchantress resides, and where also is this infamous
paramour, whom she has entombed before his death. “My lord,”
answered the prince, “he, as I have before mentioned, is at the
Palace of Tears, in a tomb, formed like a dome; and this palace has
a communication with the castle on the side towards the entrance. I
cannot exactly tell you to what spot the enchantress has retired; but
she visits her lover every day at sun-rise, after having inflicted on
me the sanguinary punishment I related: and you may easily judge,
that I cannot defend myself from such great cruelty. She always
brings with her a sort of liquor, which is the only thing that is able to
keep him alive; and she never ceases to complain of the silence
which he has invariably kept since he was wounded.”

“No one, prince,” replied the sultan, “deserves greater


commisseration than yourself; nor can any one be more sensible of
your misfortune than I am. A more extraordinary fate can never
have happened to any; and they, who may hereafter compose your
history, will be able to relate an event the most surprising of any
hitherto recorded. One thing only is wanting to complete it, and that
is for you to be revenged: nor will I leave any thing untried to
accomplish it.” The sultan having first informed the prince who he
was, and the reason of his entering the castle, consulted with him
on the best means of affording him a just revenge; and a plan
occurred to the sultan, which he directly communicated. They then
agreed upon the steps it was necessary to take, in order to insure
success; and they deferred the execution of the plan till the
following day. In the mean time, as the night was far advanced, the
sultan took some repose. The young prince, as usual, passed his
time in continual watchfulness; for he was unable to sleep since his
enchantment: the hopes, however slight, which he cherished of
being soon relieved from his sufferings constantly occupied his
thoughts.

The sultan rose as soon as it was day; and having concealed his
robe and external dress, which might incumber him, he went to the
Palace of Tears. He found it illuminated by a multitude of torches of
white wax; and a delicious perfume issuing from various beautiful
golden vases, regularly arranged, struck his senses. As soon as he
perceived the bed on which the black was laid, he drew his sabre,
and destroyed, without resistance, the little remains of life in this
wretch. He then dragged the body into the court of the castle, and
threw it into a well. Having done this he returned, and laid down in
the black’s place, hiding his sabre under the covering, and remained
there in order to complete what he projected. The enchantress
arrived soon after: her first business was to go into the apartment
where the king of the Black Isles, her husband, was. She directly
stripped him, and, with unexampled barbarity, began to inflict upon
his shoulders the accustomed number of blows. The poor prince
filled the whole building with his cries, and conjured her in the most
pathetic manner to have pity on him: the wretch, however, ceased
not to beat him till she had completed the hundred. “Thou hadst no
compassion on my lover,” said she, “expect therefore none from me.”
As soon as she had finished, she threw the coarse garment made of
goat-skin over him, and then the robe of brocade. She next went to
the Palace of Tears; and, on entering, began to renew her
lamentations. When she approached the couch where she thought
her lover always remained, she exclaimed, “What cruelty to have
thus destroyed the tranquil joy of so tender and fond a mistress as I
am! Cruel prince, thou reproachest me with being inhuman, when I
make thee feel the effects of my resentment, and has not thy
barbarity far exceeded my revenge? Hast thou not, traitor, in
destroying almost the existence of so adorable an object, equally
destroyed mine? Alas!” added she, addressing herself to the sultan,
whom she took for the black, “will you always, light of my life,
preserve this silence? Are you resolved to let me die without the
consolation of hearing you again declare you love me. Utter, at least,
one word, I conjure you.”

The sultan then, pretending to awake from a profound sleep, and


imitating the language of the blacks, answered the queen in a
solemn tone. “There is no strength or power, but in God alone, who
is all-powerful.” At these words the enchantress, to whom they were
unexpected, gave a violent scream through excess of joy. “My dear
lord,” she exclaimed, “do you deceive me: is what I hear true? Is it
really you who speak?”—“Wretched woman,” replied the sultan, “are
you worthy of an answer?”—“What!” cried the queen, “do you
reproach me?”—“The cries, the tears, the groans of thy husband,”
answered the supposed black, “whom you every day beat with so
much indignity and barbarity, continually prevent my rest: I should
have been cured long since, and recovered the use of my tongue, if
you had disenchanted him. This, and this only, is the cause of my
silence, and of which you so severely complain.”—“Well then,” said
the enchantress, “to satisfy you, I am ready to do what you
command: do you wish him to reassume his first form?”—“Yes,”
replied the sultan, “and hasten to set him free, that I may no longer
be disturbed by his cries.”

The queen immediately went out from the Palace of Tears; and
taking a vessel of water, she pronounced over it some words, which
caused it instantly to boil, as if it had been placed on a fire. She
proceeded to the apartment, where the young king, her husband,
was; “If the creator of all things,” said she, throwing the water over
him, “hath formed thee as thou now art, or if he is angry with thee,
do not change; but if thou art in that state by virtue of my
inchantment, reassume thy natural form, and become the same as
before.” She had hardly concluded, when the prince, recovering his
first shape, rose up with all possible joy, and returned thanks to God.
“Go,” said the enchantress, addressing him, “hasten from this castle,
and never return, lest it should cost you your life.”—The young king
yielded to necessity, and left the queen without replying a word. He
concealed himself in some secure spot, where he impatiently waited
the completion of the sultan’s design, the commencement of which
had been so successful.

The enchantress then returned to the Palace of Tears; and on


entering said to him whom she supposed to be the black, “I have
done, my love, what you ordered me; nothing, therefore, now
prevents your getting up, and affording me the satisfaction I have so
long been deprived of.” The sultan, still imitating the language of the
blacks, answered in rather a sharp tone, “What you have yet done is
not sufficient for my cure. You have destroyed only a part of the evil:
but you must strike at the root.”—“What do you mean by the root,
my amiable black?” answered she.—“What can I mean,” he cried,
“but the city and its inhabitants, and the four isles, which you have
destroyed by your magic? Every day towards midnight the fish
constantly raise their heads out of the pond, and call for vengeance
against us both. This is the real cause of the delay of my recovery.
Go quickly and re-establish every thing in its former state; and on
thy return I will give you my hand, and you shall assist me in rising.”

The queen, exulting in the expectations these words produced,


joyfully exclaimed, “You shall soon then, my life, recover your
health; for I will instantly go and do what you have commanded.” In
fact she went the very next moment, and when she arrived on the
border of the pond, she took a little water in her hand and scattered
it about. She had no sooner done so, and pronounced certain words
over the fish and the pond, than the city instantly appeared. The fish
became men, women, and children; Mahometans, Christians,
Persians, and Jews; freemen or slaves; in short, each took his
natural form. The houses and shops became filled with inhabitants,
who found every thing in the same situation and order in which they
were previous to the change. The officers and attendants of the
sultan, who were very numerous, and who were encamped directly
where the great place, or square, happened to be, were astonished
at finding themselves on a sudden in the midst of a large, well-built,
and inhabited city.

But to return to the enchantress: as soon as she had completed


this change she hastened back to the Palace of Tears, to enjoy the
reward of her labours. “My dear lord,” she cried on entering, “I am
returned to participate in the pleasure of your renewed health, for I
have done all you have required of me; arise, and give me your
hand.”—“Come near then,” said the sultan, still imitating the manner
of the blacks. She did so. “Nearer still,” he cried. She obeyed. Then
raising himself up, he seized her so suddenly by the arms, that she
had no opportunity of recognizing who it was; and with one stroke
of his sabre, he separated her body in two, which fell on each side of
him. Having done this, he left the carcase in the same place, and
went to seek for the prince of the Black Isles, who waited with the
greatest impatience for him. “Rejoice, prince,” said he, embracing
him, “you have nothing more to fear; for your cruel enemy no longer
exists.”
The young prince thanked the sultan in a way which proved that
his heart was truly penetrated with gratitude; and as a reward, for
the important service he had rendered him, he wished him a long
life and the greatest prosperity. “May you, too, live happily and at
peace in your capital,” replied the sultan to him, “and should you
hereafter have a wish to visit mine, which is so near, I shall receive
you with the truest pleasure; and you shall be as highly honoured
and respected as in your own.”—“Powerful monarch,” answered the
prince, “to whom I am so much indebted, do you think you are very
near your capital?”—“Certainly,” replied the sultan, “I think so, at
least that I am not more than four or five hours journey.”—“It is a
whole year’s journey,” added the prince, “although I believe you
might come here in the time you mention, because mine was
enchanted; but since it is no longer so, things are changed. This,
however, shall not prevent my following you, were it necessary to go
to the very extremity of the earth. You are my liberator; and to shew
you every mark of my gratitude as long as I live, I shall freely
accompany you and resign my kingdom without regret.”

The sultan was extremely surprised to find that he was so distant


from his dominions, and could not comprehend how it happened;
but the young king of the Black Isles convinced him so fully of the
possibility, that he no longer doubted it.—“It matters not then,”
resumed the sultan; “the trouble of returning to my dominions will
be sufficiently recompensed by the satisfaction arising from having
assisted you, and from having acquired a son in you; for, as you will
do me the honor to accompany me, I shall look upon you as such;
and having no children of my own, I from this moment make you my
heir and successor.”—This interview between the sultan and the king
of the Black Isles was terminated by the most affectionate
embraces; after which the young prince prepared for his journey. In
three weeks he was ready to depart, greatly regretted by his court
and subjects, who received from his hands a near relation of his as
their king.
At length the sultan and the prince set out with a hundred camels
laden with inestimable riches, which had been selected from the
treasury of the young king, who was accompanied by fifty handsome
nobles, well mounted and equipped. Their journey was a pleasant
one; and when the sultan, who had dispatched couriers to give
notice of his arrival, and relate the reason of his delay, drew near to
his capital, the principal officers, whom he had left there, came to
receive him; and to assure him, that his long absence had not
occasioned any change in his empire. The inhabitants, also, crowded
to meet him, and welcome him with acclamations and every
demonstration of joy, which lasted for several days.

The day after his arrival, the sultan assembled his courtiers, and
gave them an ample detail of the occurrences, which, contrary to his
wishes, had delayed his return: he then declared to them his
intention of adopting the king of the four Black Isles, who had left a
large kingdom to accompany and live with him; and at last, to
reward the fidelity with which they served him, he bestowed
presents on all, according to their rank and station.

With regard to the fisherman, as he had been the first cause of the
deliverance of the young prince, the sultan overwhelmed him with
rewards, and made him and his family happy and comfortable for
the rest of their days.
THE HISTORY

OF THREE CALENDERS, SONS OF KINGS, AND OF FIVE LADIES


OF BAGDAD.

During the reign of the Caliph Haroun Alraschid there lived at


Bagdad a porter, who, notwithstanding his low and laborious
profession, was nevertheless a man of wit and humour. One
morning, when he was standing with a large basket before him, in a
place where he usually waited for employment, a young lady of a
fine figure, covered with a large muslin veil, came up to him, and
said with a pleasing air, “Porter, take up your basket and follow me.”
The porter, delighted with these few words, pronounced in so
agreeable a manner, put it on his head and went after the lady,
saying, “Oh happy day! Oh happy meeting!”

The lady stopped at a closed door, and knocked. A venerable


Christian, with a long white beard, opened it, and she put some
money into his hands without saying a single word; but the
Christian, who knew what she wanted, went in, and shortly after
brought out a large jar of excellent wine. “Take this jar,” said the lady
to the porter, “and put it in the basket.” This being done, she desired
him to follow her, and walked on; the porter still exclaiming, “Oh day
of happiness! Oh day of agreeable surprise and joy!”

The lady stopped at the shop of a seller of fruits and flowers,


where she chose various sorts of apples, apricots, peaches, lemons,
citrons, oranges, myrtles, sweet basil, lilies, jessamine, and some
other sweet-scented flowers and plants. She told the porter to put all
those things in his basket, and follow her. Passing by a butcher’s
shop, she ordered five and twenty pounds of his finest meat to be
weighed, which was also put into the porter’s basket.
At another shop she bought some capers, tarragon, small
cucumbers, parsley, and other herbs, pickled in vinegar: at another,
some pistachios, walnuts, hazel-nuts, almonds, kernels of the pine,
and other similar fruits: at a third she purchased all sorts of almond
patties. The porter, in putting all these things into his basket, which
began to fill it, said; “My good lady, you should have told me, that
you intended buying so many things, and I would have provided a
horse, or rather a camel, to carry them. I shall have more than I can
lift, if you add much to what is already here.” The lady laughed at
this speech, and again desired him to follow her.

She then went into a druggist’s, where she furnished herself with
all sorts of sweet-scented waters, with cloves, nutmeg, pepper,
ginger, a large piece of ambergris, and several other Indian spices,
which completely filled the porter’s basket, whom she still ordered to
follow her. He did so, till they arrived at a magnificent house, the
front of which was ornamented with handsome columns, and at the
entrance was a door of ivory. Here they stopped, and the lady gave
a gentle knock at the door. While they waited for it to be opened,
the porter’s mind was filled with a thousand different thoughts. He
was surprised that a lady dressed as this was, should perform the
office of housekeeper, for he conceived it impossible for her to be a
slave. Her air was so noble, that he supposed her free, if not a
person of distinction. He was wishing to ask her some questions
concerning her quality and situation, but just as he was preparing to
speak, another female who opened the door, appeared to him so
beautiful, that he was silent through astonishment, or rather he was
so struck with the brilliancy of her charms, that he was very near
letting his basket and all that was in it fall; so much did this object
make him forget himself. He thought he had never seen any beauty
in his whole life that equalled her who was before him. The lady who
had brought the porter, observed the disturbed state of his mind,
and well knew the cause of it. This discovery diverted her; and she
took so much pleasure in examining the countenance of the porter,
that she forgot the door was open. “Come in, sister,” said the
beautiful portress, “what do you wait for? Don’t you see that this
poor man is so heavily laden he can hardly bear it?”

As soon as she and the porter were come in, the lady who opened
the door shut it; and all three, after passing through a handsome
vestibule, crossed a very spacious court, surrounded by an open
gallery, or corridor, which communicated with many magnificent
apartments, all on the same floor. At the bottom of this court there
was a sort of cabinet, richly furnished, with a throne of amber in the
middle, supported by four ebony pillars, enriched with diamonds and
pearls of an extraordinary size, and covered with red satin, relieved
by a bordering of Indian gold, of admirable workmanship. In the
middle of the court there was a large basin lined with white marble,
and full of the finest transparent water, which rushed from the
mouth of a lion of gilt bronze.

Although the porter was so laden it did not prevent him from
admiring the magnificence of this house, and the neatness and
regularity with which every thing was arranged; but what principally
attracted his attention, was a third lady, who appeared still more
beautiful than the second, and who was seated on the throne before
mentioned. As soon as she perceived the other two females, she
came down from the throne, and advanced towards them. The
porter conjectured, from the looks and behaviour of the two first
ladies, that this was the principal personage; and he was not
mistaken. This lady was called Zobeidè; she who opened the door
was called Safiè, and the name of the one who had been for the
provisions, was Aminè.

“You do not, my dear sisters,” said Zobeidè, accosting the other


two, “perceive that this man is almost fainting under his load? Why
do you not discharge him?” Aminè and Safiè then took the basket,
one before and the other behind; Zobeidè also assisted, and all three
put it on the ground. They then began to empty it, and when they
had done, the agreeable Aminè took out her purse, and rewarded
the porter very liberally. He was well satisfied with what he received,
and was taking up his basket to go, but could not muster sufficient
resolution, so much was he delighted by the sight of three such rare
beauties, who now appeared to him equally charming; for Aminè
had also taken off her veil, and he found her quite as handsome as
the others. The thing that puzzled him most, was not seeing any
man in the house; and yet a great part of the provisions he brought,
such as dried fruits, cakes, and sweetmeats, were most adapted to
those who wish to drink much and feast.

Zobeidè at first thought the porter was waiting to get breath, but
observing him remain a long time, she asked him what he waited for,
and whether he was sufficiently paid. “Give him something more,”
added she, speaking to Aminè, “and let him be satisfied.”—“Madam,”
answered the porter, “it is not that which detains me; I am already
almost too well paid for my trouble. I know very well that I am guilty
of an incivility in staying where I ought not; but I hope you will have
the goodness to pardon it, from the astonishment I experience in
observing no man among three ladies of such uncommon beauty. A
party of ladies without men is as melancholy and stupid as a party of
men without ladies.” To this he added some pleasantries in proof of
what he advanced. He did not forget to repeat what they say at
Bagdad, that there was no comfort at table unless there were four;
and he concluded by saying that as they were three, they had the
greatest want of a fourth.

The ladies laughed heartily at the reasoning of the porter. Zobeidè,


however, then addressed him in a serious manner. “You carry your
fooleries, my friend, a little too far; but though you do not deserve
that I should enter into any explanation with you, I will at once
inform you, that we are three sisters, who arrange all our affairs so
secretly, that no one knows any thing of them. We have too great
reason to fear a discovery to permit us to impart our arrangements;
and an established author whom we have read, says, Keep thy own
secret, and tell it to no one; for he who reveals a secret is no longer
master of it. If thy own breast cannot contain thy secret, how can
the breast of him to whom you intrust it?”
“Ladies,” replied the porter, “from your appearance alone I thought
you possessed a singular degree of merit; and I perceive that I am
not mistaken. Although fortune has not been so propitious to me, as
to bring me up to any profession, superior to the one I follow, yet I
have cultivated my mind as much as I was able by reading books of
science and history; and permit me, I entreat, to say, that I also
have read in another a maxim which I have always happily
practised; Conceal your secret, he says, only from such as are
known to be indiscreet, and who will abuse your confidence; but
make no difficulty in discovering it to prudent men, because they
know how to keep it. The secret, then, with me is as safe as locked
up in a cabinet, the key of which is lost, and the door sealed.”

Zobeidè saw that the porter was not deficient in cleverness, but
thinking that he was desirous of being at the entertainment they
were going to have, she good-humouredly replied, “You know that
we are preparing to regale ourselves, and you must also know we
cannot do this but at a considerable expense; and it would not be
just that you should partake of the feast without bearing part of the
costs.” The beautiful Safiè was of the same opinion as her sister. “My
friend,” she said to the porter, “have you never heard the common
saying, if you bring something you shall return with something; if
you bring nothing, you shall carry nothing back?”

The porter would have been obliged to retire in confusion in spite


of his rhetoric, had it not been for Aminè, who took his part very
strongly: “My dear sisters,” she said to Zobeidè and Safiè, “I entreat
you to permit him to remain with us. It is unnecessary to tell you he
will divert us, for you must see he is capable of it. I assure you that
had it not been for his readiness, quickness, and courage to follow
me, I should not have executed so many commissions in so short a
time. Besides, if I were to repeat to you all the amusing things he
said to me on the way, you would not be much surprised that I am
become his advocate.”
At this speech of Aminè’s, the porter in a transport of joy fell on his
knees and kissed the ground at the feet of this charming female.
“My dear lady,” said he, raising himself, “you have from this moment
begun my happiness, and placed it almost at its summit by so
generous an act, for which I can never sufficiently express my
gratitude. In short, ladies,” added he, addressing the three sisters at
once, “do not suppose, because you have done me so great an
honor, that I will abuse it; and that I shall consider myself as a man
who is worthy of it; on the contrary, I shall ever regard myself as the
humblest of your slaves.” In saying this he wished to return the
money he had received, but the grave Zobeidè ordered him to keep
it. “What we have once given,” she said, “as a recompense to those
who have rendered us any service, never returns. But in agreeing
that you should remain with us, it is not only on condition that you
keep the secret we are going to intrust you with, but we also
require, that you shall strictly observe the rules of propriety and
decorum.” While she was speaking, the beautiful Aminè took off her
walking dress, and fastening her robe to her girdle, in order to be
more at liberty to prepare the table, she placed on it various kinds of
meat, and put some bottles of wine, and several golden cups upon a
sideboard. This done, the ladies seated themselves round the table,
and made the porter place himself by their side, who was delighted
beyond measure, at seeing himself at table with three persons of
such extraordinary beauty.

They had scarcely began to eat, when Aminè, who had placed
herself near the buffet, or sideboard, took a bottle and goblet, and
poured some for herself. Having drank the first glass, according to
the Arabian custom, she then poured out one for each of her sisters,
who drank it one after the other. Then filling the same goblet for the
fourth time, she presented it to the porter, who in taking it, kissed
her hand, and before he drank it he sung a song, the meaning of
which was, that as the wind carried with it the odour of any
perfumed spot over which it passed, so the wine, which he was
about to drink, coming from her hand acquired a more exquisite
flavour than it naturally possessed. This song pleased them very
much, and they each sung in their turn. In short the whole company
were in most excellent spirits during the repast, which lasted a long
time, and was accompanied with every thing that could render it
agreeable.

The day began to close, when Safiè, in the name of her sisters,
said to the porter, “Arise, and go it; is time to retire.” To this the
porter, not having resolution to quit them, answered, “Ah, ladies,
where would you command me to go in the state I am in? I am
almost beside myself from gazing on you, and the good cheer you
have given me; and I shall never find the way to my own house.
Allow me the night to recover myself in; I will pass it wherever you
please, but less time will not restore me to the state I was in, when I
came here; and even then I doubt I shall leave the better part of
myself behind.”

Aminè again took the part of the porter: “He is right, my sister,”
she exclaimed; “I am convinced of the propriety of his demand. He
has sufficiently diverted us; and if you wish to believe me, or rather
if you love me, I am sure you will suffer him to pass the evening
with us.”—“We cannot refuse any request of yours, my sister,”
replied Zobeidè. “Porter,” she added, addressing herself to him; “we
wish to grant you even this favour, but we must premise a fresh
condition: whatever we may do in your presence, with respect to
yourself or any thing else, take great care that you do not ask the
reason; for in questioning us about things that do not at all concern
you, you may hear what will not please you. Take care, therefore,
and be not too curious in attempting to discover the motives of our
actions.”

“Madam,” replied the porter, “I promise to observe the conditions


with so much exactitude, that you shall have no reason to reproach
me with having infringed them, and even still less to punish my
indiscretion. My tongue shall be motionless; and my eyes shall be
like a mirror, that preserves no part of the objects it receives.”—“To
let you see,” said Zobeidè, with a serious air, “that what we require
of you is not newly established among us, observe what is written
over the door, on the inside.” The porter went and read these words,
which were written in large letters of gold, whoever talks about what
DOES NOT CONCERN HIM, OFTEN HEARS WHAT DOES not please
him! He came back directly, and said to the three sisters, “I swear to you,
ladies, that you shall not hear me speak a word concerning any thing which
does not regard me, and in which you have any interest.”

This being settled, Aminè brought supper; and when she had
lighted up the hall with numerous candles prepared with aloes and
ambergris, which scattered a very agreeable perfume, and cast a
brilliant light, she seated herself at the table with her sisters and the
porter. They began to eat, drink, sing, and recite verses. The
females took pleasure in making the porter intoxicated, under the
pretence of making him drink to their health. Wit and repartee were
not wanting. They were at length all in the best humour, when they
heard a knocking at the gate. They instantly got up, and all run to
open it; but Safiè, to whom this office more particularly belonged,
was the most active. The other two, seeing her before them,
stopped, and waited till she came back to inform them who could
have any business with them at so late an hour. Safiè soon returned.
“A charming opportunity, my sisters, offers itself to spend great part
of the night very pleasantly, and if you are of the same opinion as I
am, we will not let it escape us. There are three calenders at the
door; at least they appear so by their dress; but what will doubtless
surprise you is, that they are all three blind of the right eye, and
have their heads, beards, and eyebrows shaved. They say, they are
only just arrived at Bagdad, where they have never been before, and
as it is dark, and they knew not where to lodge, they knocked at our
door by chance; and entreat us for the love of God, to have the
charity to take them in. They care not where we put them, provided
they are under cover; and will be satisfied even with a stable. They
are young and well-made and appear to possess some spirit, but I
cannot without laughing, think of their amusing and uniform figures.
Safiè could not indeed refrain from laughing most heartily at this
moment, nor could either her sisters or the porter do otherwise than
join in it. “Shall we,” said she, “let them come in? It is impossible but
that with such men as I have described, we shall finish the day still
better than we begun it. They will divert us very much, and they will
be no expense to us, since they only ask a lodging for one night,
and it is their intention to leave us as soon as it is day.”

Zobeidè and Aminè made some difficulty in agreeing to the request


of Safiè; and she herself well knew the reason of it: but expressed
so great a desire to have her way, that they could not refuse her.
“Go,” said Zobeidè to her, “and let them come in, but do not fail to
caution them not to speak about what does not concern them, and
make them read the inscription over the inside of the door. At these
words, Safiè joyfully ran to open the door, and soon returned,
accompanied by the three calenders.

On entering they made a low bow to the sisters, who had risen to
receive them; and who obligingly told them they were welcome, and
that they were happy in being able to oblige them, and contribute
towards lessening the fatigue of their journey. They then invited
their new guests to sit down with them. The magnificence of the
place and the kindness of the ladies gave the calenders a very high
idea of the beautiful hostess and her sisters; but before they took
their places, having by chance cast their eyes towards the porter,
and observing that he was dressed very like other calenders, from
whom they differed in many points of discipline, and whose beard
and eyebrows were not shaved, one of them said, “This man
appears to be one of our Arabian brethren, who revolted.”

The porter, half asleep and heated with the wine he had drunk,
was much disturbed at these words; and without getting up he said
to the calenders, casting at the same time a fierce look at them,
“Seat yourselves, and meddle not with what does not concern you.
Have you not read the inscription over the door? Do not pretend
then to make the world live after your fashion; but live according to
ours.”—“My good friend,” replied the calender, who had before
spoken, “do not be angry, for we should be very sorry to give you
any cause; on the contrary, we are ready to receive your
commands.” The dispute would not have ended here had not the
ladies interfered, and pacified all parties.

When the calenders were seated, the sisters helped them, and the
delighted Safiè in particular took care to supply them with wine.
When they had both eaten and drunk as much as they wished, they
intimated that they should be happy to give them some music, if
they had any instruments, and would order them to be brought.
They accepted the offer with pleasure; and the beautiful Safiè
immediately got up to enquire after some, and returned the next
moment and offered them a flute of that country, also another used
in Persia, and a tambour de basque. Each calender received from
her hand that instrument he liked best, and they all began to play a
little air. The females were acquainted with the words, which were
very lively, and accompanied the air with their voices: frequently
interrupting each other with fits of laughter from the nature of the
words.

In the midst of this entertainment, and when the party were highly
delighted, they heard a knock at the door. Safiè immediately left off
singing, and went to see who it was.

“But I must now inform you, Sire,” said Scheherazadè to the


sultan, in this place, “that it is proper for your majesty to know how
any one came to knock so late at the door of this house. The caliph
Haroun Alraschid made it a practice to go very often, during the
night, through the city in disguise, in order to discover whether
every thing was quiet. On this evening, therefore, the caliph set out
from his palace, at his accustomed hour, accompanied by Giafar, his
grand vizier, and Mesrour, chief of the eunuchs, all three disguised as
merchants. In passing through the street where these ladies lived,
the prince heard the sound of the instruments, interrupted by
laughter, and said to his vizier, “Go and knock at the door of that
house, where I hear so much noise; I wish to gain admittance, and
learn the cause of it.” The vizier endeavoured to persuade the caliph
that they were only women, who were making merry that evening,
and the wine seemed to have exhilirated their spirits; and that they
ought not to expose themselves, where it was probable they might
meet with some insult; besides, the time, he said, was improper, and
it was useless to disturb their amusements. “Never mind,” said the
caliph, “knock as I order you.”

It was, then, the grand vizier Giafar who had knocked at the door
by order of the caliph, who wished not to be known. Safiè opened it,
and the vizier observed, by the light of a candle she carried, that she
was very beautiful. He played his part very well. He first made a
most profound reverence, and then, with a respectful air, he said,
“Madam, we are three merchants of Moussoul, and arrived here
about ten days ago, with some very rich merchandise, which we
have deposited in a khan; where we have taken up our lodging. We
have been to spend the day with a merchant of this city, who had
invited us to go to see him. He treated us with a fine collation; and
as the wine we drunk put us into a very good humour, he sent for a
company of dancers. The night was already far advanced, and while
we were playing on our instruments, the others dancing, and the
whole company making a great noise, the watch happened to pass
by, and obliged us to open the door. Some of the company were
arrested: we were however so fortunate as to escape, by getting
over a wall. But,” added the vizier, “as we are strangers, and have
taken perhaps rather more wine than we ought, we are afraid of
meeting with a second party of the watch, or perhaps the same
before we arrive at our khan, which is at a considerable distance
from hence. And we should even then get there to no purpose, for
the gate would be shut, and whoever may come there, they will not
open it till morning. This is the reason, madam, that as we heard, in
passing by, the sound of instruments and voices, we thought all
those who belonged to the house were not yet retired, and we took
the liberty to knock, to beg you to afford us a retreat till the
morning. If we appear to you worthy of taking a part in your
amusements, we will endeavour, as far as we are able, to contribute
to it, in order to repair the interruption we have caused; if not, do us
at least the favor to suffer us to pass the night under the cover of
your vestibule.”

During this speech of Giafar, the beautiful Safiè had an opportunity


of examining the vizier and the two persons whom he also called
merchants, and judging from their countenances that they were not
common men, she said that she was not mistress, but if they would
give themselves a moment’s patience she would return and bring the
answer. Safiè went and related all this to her sisters, who hesitated
some time as to what they ought to do. But they were naturally
kind, and as they had conferred the same favor on the three
calenders, they resolved to permit these also to come in. The caliph,
the grand vizier, and the chief of the eunuchs, being introduced by
the beautiful Safiè, saluted the ladies and the calenders with great
civility. They, supposing them merchants, returned it in the same
manner; and Zobeidè, as the principal person, with that grave and
serious air which so well suited her, said, “You are welcome, but in
the first place do not take it ill if we ask of you one favor.”—“What
favor,” cried the vizier, “can we refuse to such beautiful ladies!”—“It
is,” replied Zobeidè, “to have only eyes and no speech; to forbear
from asking questions about what you may see, in order to learn the
cause; and not to speak about what does not concern you, for fear
you should hear what will not be pleasant to you.”—“You shall be
obeyed, madam,” replied the vizier; “for we are neither censurers
nor curious imprudent persons. It is enough for us to attend to our
own business without meddling with what does not regard us.” After
this each seated himself, and the conversation became general; and
they drank to the health of the new guests.

While the vizier Giafar entertained them, the caliph ceased not
from admiring the extraordinary beauty, the great elegance, the
lively disposition and spirit of the ladies; while the appearance of the
three calenders, all blind of the right eye, surprised him very much.
He anxiously wished to learn the cause of this singularity, but the
conditions they had imposed upon him and his companions,
prevented any inquiry. Besides all this, when he reflected upon the
richness of the services and furniture; with the regularity and
arrangement every where apparent, he could hardly persuade
himself it was not the effect of enchantment.

The conversation having fallen upon the various sorts of


amusement, and the different modes of enjoying life, the calenders
got up and danced in their peculiar way, which much augmented the
good opinion the ladies had already conceived of them; and
attracted also the applause and esteem of the caliph and his
company. As soon as the calenders had finished, Zobeidè got up,
and taking Aminè by the hand, said to her, “Come, sister, the
company shall not think that we will put them under any restraint;
nor shall their presence prevent us from doing as we have always
been accustomed.” Aminè, who perfectly understood what her sister
meant, got up and took away the dishes, tables, bottles, glasses,
and also the instruments on which the calenders had played. Nor did
Safiè remain idle; she swept the hall, put every thing in its proper
place, snuffed the candles, and added more aloe wood and
ambergris. Having done this, she requested the three calenders to
sit on a sofa on one side, and the caliph and his company on the
other. “Get up,” said she then to the porter, looking at him, “and be
ready to assist in whatever we want you; a man like you, as strong
as the house, ought never to remain idle.” The porter had slept till
he was rather more sober: he got up therefore very quickly, and
after fastening his cloak to his girdle, “I am ready,” he cried, “to do
any thing you please.”—“That is well,” answered Safiè, “and you
shall not remain long with your arms crossed.” A little while after
Aminè came in with a sort of seat, which she placed in the middle of
the room. She then went to the door of a closet, and having opened
it, she made a sign to the porter to approach. “Come and assist me,”
she cried. He did so, and went in with her, and returned a moment
after, followed by two black dogs, each of which had a collar with a
chain fastened to it, by which he held them. He brought these dogs,
which appeared to have been very ill used and beaten with a whip,
into the middle of the room.
Zobeidè, who was sitting between the calenders and the caliph,
then got up, and approaching to the porter in a very grave manner,
“We must,” cried she, with a deep sigh, “do our duty.” She then
turned up her sleeves, so as to uncover her arms up to the elbow,
and after taking a whip which Safiè presented to her, “Porter,” she
said, “take one of these dogs to my sister Aminè, and then come to
me with the other.” The porter did as he was ordered; and as he
approached Zobeidè, the dog, which he held, immediately began to
howl, and turning towards her lifted up its head in a most
supplicating manner. But she, without regarding the melancholy
expressions of the dog, which must have excited pity, or its cries
which filled the whole house, flogged it till she was out of breath,
and when she had not strength left to beat it any more, she threw
away the whip; then taking the chain from the porter, she took up
the dog by the paws, and both looking at each other with a
melancholy air, they mingled their tears together. Zobeidè after this
took out her handkerchief, wiped the tears from its eyes and kissed
it, then returning the chain to the porter, she desired him to lead
that back from whence he had taken it, and bring her the other.

The porter carried the one that had been beaten back to the
closet; and in returning took the other from the hands of Aminè, and
presented it to Zobeidè, who was waiting for it. “Hold it as you did
the first,” said she; then taking the whip, she served this in the same
manner. She then wept with it, dried its tears, kissed it, and returned
it to the porter, who was saved the trouble of carrying it back to the
closet by the agreeable Aminè, who took it herself.

The three calenders, as well as the caliph and his party, were
much astonished at this ceremony. They could not comprehend why
Zobeidè, after having whipped, with so much violence, the two dogs,
which, according to the tenets of the Mussulman religion, are impure
animals, should afterwards weep with them, kiss them, and dry their
tears. They conversed together about it, and the caliph in particular
was very desirous of knowing the reason of an action which
appeared to him so singular. He made signs to the vizier to inquire,
but he turned his head another way, till at last, importuned by
repeated signs, he answered in the same manner, that it was not yet
time to satisfy his curiosity.

Zobeidè remained for some time in the middle of the room, as if to


rest from her fatigue in beating the two dogs. “My dear sister,” said
the beautiful Safiè, “will you not return to your place, that I also may
perform my part?”—“Yes,” replied Zobeidè, and seated herself on the
sofa with the caliph, Giafar, and Mesrour, on her right hand, and the
three calenders and the porter on her left.

The company continued for some time silent: at length Safiè, who
had placed herself on the seat in the middle of the room, said to
Aminè, “Sister get up, you understand what I mean.” Aminè rose
and went into a different closet from that whence the dogs were
brought; she returned with a case covered with yellow satin, and
richly ornamented with an embroidery of green and gold. She
opened it, and took out a lute, which she presented to her sister.
Safiè took it, and after having tuned it, began to accompany it with
her voice: she sung an air on the torments of absence, in so
agreeable a style, that the caliph and the rest of the company were
enchanted. When she had finished, as she had sung with a great
deal of action as well as passion, she offered the lute to Aminè,
saying, “Sister, my voice fails me; do you take it, and oblige the
company by playing and singing instead of me.”

Aminè having played a little prelude, to hear if the instrument was


in tune, sung for some time on the same subject, but she became so
affected by the words she uttered, that she had not power to finish
the air. Zobeidè began to praise her sister: “You have done
wonders,” said she, “it is easy to perceive that you feel the griefs you
express.” Aminè had not time to reply to this speech; she felt herself
so oppressed at that moment, that she could think of nothing but
giving herself air, and opening her robe, she exposed a bosom, not
white as the beautiful Aminè ought to have had, but so covered with
scars, as to create a species of horror in the spectators. This,
however, was of no service to her, and she fainted away.

Whilst Zobeidè and Safiè ran to assist their sister, one of the
calenders exclaimed, “We had better have slept in the open air than
come here to witness such a spectacle.”

The caliph, who heard him, drew near, and enquired what all this
meant: “We know no more than you,” replied the calender. “What,”
resumed the caliph, “do not you belong to the house? cannot you
inform me about these two black dogs, and this lady, who appears
to have been so ill treated?”—“Sir,” said the calender, “we never
were in this house before now, and entered it only a few minutes
sooner than you did.” This increased the astonishment of the caliph,
“Perhaps,” said he, “the man who is with you can give us some
information.” The calender made signs to the porter to draw near,
and asked him if he knew why the black dogs had been beaten, and
why the bosom of Aminè was so scarred. “Sir,” replied the porter, “I
swear by the great living God, that if you know nothing of the
matter, we are all equally ignorant. It is true that I live in the city,
but before to-day I never entered this house; and if you are
surprised to see me here, I am not less so at being in such company.
What increases my surprise,” added he, “is not to see any man with
these ladies.”

The caliph and his party, as well as the calenders, thought that the
porter belonged to the family, and that he would have been able to
have informed them of what they wished so much to know. The
caliph, whatever might be the consequence, resolved to satisfy his
curiosity. “Attend to me,” he said to the rest, “we are seven men and
there are only three women, let us then compel them to give us the
information we request; and if they refuse to comply with a good
grace, we can force them to it. The grand vizier, Giafar, opposed this
plan; and explained the consequences of it to the caliph, without
discovering to the calenders who he was, as he always addressed
him like a merchant. “Consider, sir, I beg,” said he, “that we have our
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like