AI Hints
Home›Fine-Tuning LLMs Tutorial›Setup, the Hub and pipeline()
Fine-Tuning LLMs · Lesson 7 of 120

Setting Up

Install and check.

⏱ 2 min read▶ Video at 10:29🎓 Free
Watch this lesson in the Fine-Tuning LLMs courseWatch on YouTube ↗Full Fine-Tuning LLMs course

Time to set up our tools. You need Python, version three point ten or newer, and a few libraries. A graphics card, or GPU, makes training faster, but it's not required for this course.

  • Python 3.10 or newer
  • A few libraries
  • A GPU helps, but isn't required

Install the libraries

One command installs everything. Torch is PyTorch. Then transformers, datasets, peft, and trl, which we met in the last lesson. Accelerate helps the trainers use whatever hardware you have. Run this once, in a terminal.

terminalbash
pip install torch transformers datasets peft trl accelerate

No GPU? Use the cloud

Don't have a GPU? That's fine. Everything in this course runs on a normal laptop, just more slowly. For bigger models, you can rent a GPU in the cloud. Google Colab gives you one for free, in your web browser.

keyvalue
Laptop CPUfine for small models
Google Colaba free GPU in the browser
Cloud GPUsrent by the hour
This courseruns on a laptop

Check your setup

Let's check that everything works. We import each library, and print its version. Then we ask PyTorch if a GPU is available. Run it. Every library loaded. We're running on a laptop, so GPU available is false. That's fine. Our models are small.

app.pypython
import torch, transformers, datasets, peft, trl

print("torch:       ", torch.__version__)
print("transformers:", transformers.__version__)
print("datasets:    ", datasets.__version__)
print("peft:        ", peft.__version__)
print("trl:         ", trl.__version__)
print("GPU available:", torch.cuda.is_available())
Output
torch:        2.15.0
transformers: 5.22.1
datasets:     5.1.0
peft:         0.21.3
trl:          1.18.1
GPU available: False

Summary

Let's recap. Install torch, transformers, datasets, peft, trl, and accelerate. Check the versions, to be sure they load. And remember, a GPU helps, but small models run fine without one. Next, the Hugging Face Hub.

Key takeaways
  • pip install …
  • Check the versions
  • GPU optional
Next up: The Hugging Face Hub — models you can download