My Laptop Is Too Slow to Chat With an AI, So I Gave It the Night Shift
Описание и применение
Скрипт sloth автоматически переименовывает и сортирует файлы в папке Downloads, используя локальную модель Gemma 4, и работает ночью на ноутбуке с ограниченными ресурсами.
Задача
A laptop with limited CPU, RAM and no GPU cannot run an AI chat in real time, but can run a slow inference job overnight to tidy the Downloads folder.
Результат
On a low‑spec laptop, the script processes 13 files in 8–26 s each, totaling 2–4 min per run, while keeping memory usage low. The "think":false flag reduces token generation from ~500 to ~30 per file, cutting runtime by 7–30×.
Рабочий процесс
- 1. Skip files modified in the last 24 h or with .crdownload/.part extensions.
- 2. Skip installers, archives, audio/video by extension; keep original names.
- 3. Read file preview: first two PDF pages, DOCX text, first 1,500 chars of text files, or full image.
- 4. Send preview to Gemma 4 (gemma4:e2b‑it‑qat) via Ollama with a JSON schema that forces a category (one of eight folders).
- 5. Prefix new name with file’s timestamp (YYYY‑MM‑DD_).
- 6. Move file to the chosen folder and record the move.
- 7. After all files processed, generate SLOTH_REPORT.md.
- 8. Provide python sloth.py undo
<path>to revert the last run.
Доказательства
Gemma 4 has a thinking mode, and it's on by default.
It reads each document, looks at each image, gives the file a name a human would pick, and moves it into a folder.
The heart of it is a single HTTP request to Ollama: ... "think": False ...
- Дата записи: 2026-10-21T18:11:43.459Z