Why do we need Git LFS.
To download those fancy AI models that generate images from a text prompt, ala Midjourney—but cheaper, one of the most important things you need to download is Git LFS.
VIDEOTUTORIAL OF THIS PROCEDURE
Git LFS is a functionality of the well-known Source Control Management (SCM) technology that allows you to add large files in code repositories. From there, the LFS acronym, which means Large File System.
The same concept applies when working on Virtual Machines on the cloud.
How to get Git LFS.
It turns out that Git LFS doesn't come available out of the box in most Debian distributions; in fact, Git is often unavailable depending on the specific flavor of Debian. So in this article, I will explain how to enable git LFS on a Debian virtual machine. I will use a virtual machine hosted in Google Compute Enine for this demonstration.
Once logged in the Command Line Interface, the first step will be figuring out if Git is ready to go on the machine, for that just type git --version
in the command line
You should get an output similar to this.
git version 2.30.2
If you get :
git: command not found
That means you don't have Git installed, let alone git LFS. But don't worry. With the following two commands, you can install a version of Git that is compatible with Git LFS.
Note: If you have Git but LFS is not working, the following two commands will get you the most up-to-date version of Git, which is LFS-ready.
Such is the case for the Deep Learning on Linux OS in Google Cloud.
One solution fits all.
- Run:
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
This script tells our machine where to get git-lfs from, in other words, it's laying the foundations for installing git-lfs with the following command.
Edit: also works to fix this error.
git: 'lfs' is not a git command. See 'git --help'.
- Run:
sudo apt-get install git-lfs
You're now set to use git LFS to clone large text-to-image models such as those from hugging face.
For example, the repository for openjourney-v2, a free version of Midjourney, contains a file that takes up 2.13Gb. Git LFS is a must if you want to clone the repository with the model.
To download the whole repo, you run the following:
git lfs install
and then
git clone https://huggingface.co/prompthero/openjourney-v2
If everything goes well, you will see something similar to this.
Cloning into 'openjourney-v2'...
remote: Enumerating objects: 91, done.
remote: Counting objects: 100% (91/91), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 91 (delta 34), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (91/91), 2.73 MiB | 8.84 MiB/s, done.
Filtering content: 100% (5/5), 7.09 GiB | 57.55 MiB/s, done.
Top comments (0)