وقتی یه نوتبوک جدید توی گوگل کولب باز میکنی، گوگل یه ماشین مجازی (Virtual Machine) بهت میده که فقط تا وقتی فعالی وجود داره.
اگه تب رو ببندی یا چند دقیقه کاری نکنی، اون ماشین پاک میشه. یعنی هرچیزی که نصب کردی یا دانلود کردی از بین میره.
اما مهندسین هوش مصنوعی یه راهحل دارن:
درایو گوگل خودشون رو وصل میکنن و فایلهای مهم مثل مدل یا دادهها رو اونجا ذخیره میکنن:
from google.colab import drive
drive.mount('/content/drive')
یه اسکریپت آماده دارن که هر بار نوتبوک اجرا میشه، خودش بهصورت خودکار کتابخونهها رو نصب کنه:
!pip install -q torch transformers datasets
به این ترتیب، هر بار که ماشین کولب از نو شروع بشه، فقط چند ثانیه طول میکشه تا دوباره مثل قبل آمادهٔ کار بشه.
Colab’s machines are temporary
When you open a Colab notebook, Google gives you a virtual machine (VM) that exists only while your session is active. Once you close the tab or stay idle too long, it gets deleted — including everything you installed or downloaded.
But AI engineers bypass that:
They connect their Google Drive and store checkpoints or model weights there (drive.mount('/content/drive')).
They also create setup scripts that reinstall all dependencies automatically each time the notebook starts (!pip install -q torch transformers datasets).
So every time the VM restarts, it rebuilds itself in seconds.