anonderpling
commited on
Commit
•
24f6099
1
Parent(s):
7d36307
README.md
Browse files
README.md
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# A mirror of anything I find interesting on civitai or elsewhere on the web.
|
2 |
+
|
3 |
+
I dont usually download character loras, so look
|
4 |
+
elsewhere for those.
|
5 |
+
|
6 |
+
This repo is *mostly* organized around the structure
|
7 |
+
that's necessary to import the entire repo into an
|
8 |
+
automatic1111 install. This is because models were
|
9 |
+
uploaded directly from such an install via google drive in
|
10 |
+
a colab session.
|
11 |
+
|
12 |
+
Currently I'm uploading files via my new space over at
|
13 |
+
https://hf.co/anonderpling/repo_uploader, however I expect
|
14 |
+
to go back to a real file system and git uploads soon,
|
15 |
+
hopefully paperspace can help with that.
|
16 |
+
|
17 |
+
## My workflow
|
18 |
+
|
19 |
+
My workflow for downloading files into paperspace gradient
|
20 |
+
is to download the entire repo *without* pulling LFS
|
21 |
+
files, do a sparse checkout, and then pull the files I
|
22 |
+
want with LFS --include (slow) or aria2 (fast). This
|
23 |
+
workflow should work with colab, too. Whether you use
|
24 |
+
colab or paperspace, you'll probably need the latest
|
25 |
+
version of git to use `sparse-checkout --add`.
|
26 |
+
|
27 |
+
```
|
28 |
+
!GIT_LFS_SPARSE_CHECKOUT=1 git clone [email protected]:anonderpling/civitai_mirror # this is my command so I can push changes, you'll need to use the https://hf.co/ instead of [email protected]:
|
29 |
+
!cd civitai_mirror
|
30 |
+
!git sparse-checkout set embeddings # embeddings are small, so it's easy enough to just pull all of them
|
31 |
+
!git sparse-checkout add models/VAE # there's only a few VAEs, and they're generally needed, so grab all those too...
|
32 |
+
!git sparse-checkout add models/Stable-diffusion/illuminati* models/Stable-diffusion/revAnimated* # add some stable diffusion models I intend to work with in this session
|
33 |
+
!apt install aria2 # make sure aria2c is installed
|
34 |
+
# let's break the following command down into parts, since there's multiple commands on one line
|
35 |
+
# find models embeddings --type f --size -2 # find files in models and embeddings directories smaller than 2 kilobytes (these are the lfs pointers that were checked out)
|
36 |
+
# | while read a; do #lets build an aria2c input file
|
37 |
+
# echo "https://huggingface.co/anonderpling/civitai_mirror/resolve/main/${a}"; # tell aria2c where to find the file
|
38 |
+
# echo " out=${a}"; # tell aria2c where to place said file
|
39 |
+
# rm "${a}"; remove the existing file, because I'm too lazy to look up the option to have aria2c overwrite it (plus if you stop in the middle, you can tell at a glance what else is needed)
|
40 |
+
# done | tee aria2.in.txt # end the loop, but watch to make sure theres nothing accidentally included by wildcards that shouldnt have been...downloads could take a while (and fill the disk) if I accidentally put a space before the *
|
41 |
+
# aria2 -x16 --split=16 -i aria2.in.txt # download all the files as fast as possible
|
42 |
+
!find models embeddings --type f --size -2 | while read a; do echo "https://huggingface.co/anonderpling/civitai_mirror/resolve/main/${a}"; echo " out=${a}"; rm "${a}"; done | tee aria2.in.txt
|
43 |
+
!aria2 -x16 --split=16 -i aria2.in.txt
|
44 |
+
```
|
45 |
+
|
46 |
+
to upload more files:
|
47 |
+
|
48 |
+
```
|
49 |
+
# enable the git lfs filters
|
50 |
+
!pip install huggingface_hub
|
51 |
+
!huggingface-cli lfs_enable_largefiles .
|
52 |
+
# yup, not telling. I'm an *anonymous* derpling, after all
|
53 |
+
!git config --local user.name 'not telling'
|
54 |
+
# really couldnt care less if this is accurate...maybe I'll start randomizing it...
|
55 |
+
!git config --local user.email '[email protected]'
|
56 |
+
# create an rsa key with no password
|
57 |
+
!ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_hf.co -P ''
|
58 |
+
# a clickable link in jupyter/colab/paperspace
|
59 |
+
print('https://hf.co/settings/keys')
|
60 |
+
# give the public key so it can be easily copied to huggingface
|
61 |
+
!cat ~/.ssh/id_hf.co.pub
|
62 |
+
# track files 1mb+ with lfs manually (huggingface filter deals with models automatically, but large previews will give you errors)
|
63 |
+
!find -type f -size +999k -not \( -name '*.safetensors' -o -name '*.ckpt' -o -name '*.pt' \) -exec git lfs track '{}' +
|
64 |
+
# IMPORTANT: make sure you add the git ssh key above before uploading
|
65 |
+
!sleep 1m # gives you time to do so
|
66 |
+
# upload your files now. do make sure you dont upload files that didnt download properly (interrupted aria2c, lfs pointers, etc)
|
67 |
+
!git add .gitattributes models embeddings
|
68 |
+
!git commit -m "add a message..."
|
69 |
+
!git push
|
70 |
+
```
|
71 |
+
|
72 |
+
#### It's extremely important to remove the ssh key from your HF repo after you're done with it. this ensures that nobody else can access your account.
|
73 |
+
|
74 |
+
Paperspace makes free notebooks public, and I'm not sure
|
75 |
+
if that includes filesystem access or outputs; if someone
|
76 |
+
can access that ssh key and you didnt remove the access it
|
77 |
+
generates, you've given them thr ability to make changes
|
78 |
+
to your repo! This means they could delete *everything*.
|
79 |
+
If you're technically inclined, you can possibly use the
|
80 |
+
paperspace secrets configuration to hide such information
|
81 |
+
(I'm not sure how it works yet)
|
82 |
+
|
83 |
+
Alternatively, you can add big files via
|
84 |
+
https://hf.co/anonderpling/repo_uploader before your
|
85 |
+
session (the renamed file part is pretty much added for
|
86 |
+
uploading from HF urls, but also works for adding preview
|
87 |
+
images), and manually upload the civitai.info files
|
88 |
+
locally (these are just simple civitai api responses
|
89 |
+
afaik)
|
90 |
+
|
91 |
+
|
92 |
+
## TODO:
|
93 |
+
|
94 |
+
1. finish moving files around (figure out a way to do so without 2 commits per file (one to copy, one to delete file) without downloading every single file
|
95 |
+
2. move sfw models into a subdirectory
|
96 |
+
3. consider moving locons to their own directory in models, now that I'm using paperspace...
|
97 |
+
- Perpetual: keep an eye on civitai update notifications
|