This tutorial is 5 years old and it seems it doesn't work as expected.
It seems it expects data in folder
/root/.keras/datasets/flower_photos/
but (using !ls -al /root/.keras/datasets/) I found it is in
/root/.keras/datasets/flower_photos.tgz/flower_photos/
So it needs
# data_dir = pathlib.Path(archive).with_suffix('')
data_dir = pathlib.Path(archive) / 'flower_photos'
After this change next lines work.
EDIT (2025.11.02):
It seems someone reported this problem half year ago. Maybe it will be fixed.
Fixing the dataset path for images.ipynb by kiransair · Pull Request #2361 · tensorflow/docs
In this issue I added link to this question - maybe this will help.
EDIT (2025.11.04):
It seems they finally changed this path on Google Colab.