Commit
·
aa9c683
1
Parent(s):
8afc4e0
add more options + better readme
Browse files
auto-exl2-upload/auto-exl2-upload.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a85786265019ae7cda5806405f298f0803359920201db5dffb0958d55fbf76e
|
3 |
+
size 7345
|
auto-exl2-upload/exl2-quant.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
#usually it's what is on the inside that counts, not this time. This script is a mess, but at least it works.
|
2 |
#import required modules
|
3 |
-
from huggingface_hub import login, get_token, whoami, repo_exists, file_exists, upload_folder, create_repo, upload_file, create_branch
|
4 |
import os
|
5 |
import sys
|
6 |
import subprocess
|
7 |
import glob
|
|
|
8 |
|
9 |
#define os differences
|
10 |
oname = os.name
|
@@ -142,12 +143,12 @@ if repo_exists(f"{whoami().get('name', None)}/{modelname}-exl2") == False:
|
|
142 |
print("Writing model card...")
|
143 |
with open('./README.md', 'w') as file:
|
144 |
file.write(f"# Exl2 quants for [{modelname}](https://huggingface.co/{repo_url})\n\n")
|
145 |
-
file.write("## Automatically quantized using the auto quant from [hf-scripts](https://huggingface.co/anthonyg5005/hf-scripts)\n\n")
|
146 |
file.write(f"Would recommend {whoami().get('name', None)} to change up this README to include more info.\n\n")
|
147 |
file.write("### BPW:\n\n")
|
148 |
for bpw in bpwvalue:
|
149 |
-
file.write(f"[{bpw}](https://huggingface.co/{whoami().get('name', None)}/{modelname}-exl2/tree/{bpw}bpw)
|
150 |
-
file.write(f"
|
151 |
print("Created README.md")
|
152 |
|
153 |
upload_file(path_or_fileobj="README.md", path_in_repo="README.md", repo_id=f"{whoami().get('name', None)}/{modelname}-exl2", commit_message="Add temp README") #upload md file
|
@@ -186,9 +187,25 @@ for bpw in bpwvalue:
|
|
186 |
|
187 |
if file_exists(f"{whoami().get('name', None)}/{modelname}-exl2", "measurement.json") == False: #check if measurement.json exists in main
|
188 |
upload_file(path_or_fileobj=f"measurements{slsh}{model}-measure{slsh}measurement.json", path_in_repo="measurement.json", repo_id=f"{whoami().get('name', None)}/{modelname}-exl2", commit_message="Add measurement.json") #upload measurement.json to main
|
|
|
189 |
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
193 |
if tfound == 'false':
|
194 |
print(f'''
|
@@ -197,3 +214,5 @@ if tfound == 'false':
|
|
197 |
To logout, use the hf command line interface 'huggingface-cli logout'
|
198 |
To view your active account, use 'huggingface-cli whoami'
|
199 |
''')
|
|
|
|
|
|
1 |
#usually it's what is on the inside that counts, not this time. This script is a mess, but at least it works.
|
2 |
#import required modules
|
3 |
+
from huggingface_hub import login, get_token, whoami, repo_exists, file_exists, upload_folder, create_repo, upload_file, create_branch, update_repo_visibility
|
4 |
import os
|
5 |
import sys
|
6 |
import subprocess
|
7 |
import glob
|
8 |
+
import time
|
9 |
|
10 |
#define os differences
|
11 |
oname = os.name
|
|
|
143 |
print("Writing model card...")
|
144 |
with open('./README.md', 'w') as file:
|
145 |
file.write(f"# Exl2 quants for [{modelname}](https://huggingface.co/{repo_url})\n\n")
|
146 |
+
file.write("## Automatically quantized using the auto quant script from [hf-scripts](https://huggingface.co/anthonyg5005/hf-scripts)\n\n")
|
147 |
file.write(f"Would recommend {whoami().get('name', None)} to change up this README to include more info.\n\n")
|
148 |
file.write("### BPW:\n\n")
|
149 |
for bpw in bpwvalue:
|
150 |
+
file.write(f"[{bpw}](https://huggingface.co/{whoami().get('name', None)}/{modelname}-exl2/tree/{bpw}bpw)\\\n")
|
151 |
+
file.write(f"[measurement.json](https://huggingface.co/{whoami().get('name', None)}/{modelname}-exl2/resolve/main/measurement.json?download=true)\n")
|
152 |
print("Created README.md")
|
153 |
|
154 |
upload_file(path_or_fileobj="README.md", path_in_repo="README.md", repo_id=f"{whoami().get('name', None)}/{modelname}-exl2", commit_message="Add temp README") #upload md file
|
|
|
187 |
|
188 |
if file_exists(f"{whoami().get('name', None)}/{modelname}-exl2", "measurement.json") == False: #check if measurement.json exists in main
|
189 |
upload_file(path_or_fileobj=f"measurements{slsh}{model}-measure{slsh}measurement.json", path_in_repo="measurement.json", repo_id=f"{whoami().get('name', None)}/{modelname}-exl2", commit_message="Add measurement.json") #upload measurement.json to main
|
190 |
+
clear_screen()
|
191 |
|
192 |
+
delmodel = input("Do you want to delete the original model? (y/n): ")
|
193 |
+
while delmodel != 'y' and delmodel != 'n':
|
194 |
+
delmodel = input("Please enter 'y' or 'n': ")
|
195 |
+
if delmodel == 'y':
|
196 |
+
subprocess.run(f"{osrmd} models{slsh}{model}", shell=True)
|
197 |
+
print(f"Deleted models/{model}")
|
198 |
+
time.sleep(2)
|
199 |
+
clear_screen()
|
200 |
+
|
201 |
+
priv2pub = input("Do you want to make the repo public? (y/n): ")
|
202 |
+
while priv2pub != 'y' and priv2pub != 'n':
|
203 |
+
priv2pub = input("Please enter 'y' or 'n': ")
|
204 |
+
if priv2pub == 'y':
|
205 |
+
update_repo_visibility(f"{whoami().get('name', None)}/{modelname}-exl2", private=False)
|
206 |
+
print("Repo is now public.")
|
207 |
+
time.sleep(2)
|
208 |
+
clear_screen()
|
209 |
|
210 |
if tfound == 'false':
|
211 |
print(f'''
|
|
|
214 |
To logout, use the hf command line interface 'huggingface-cli logout'
|
215 |
To view your active account, use 'huggingface-cli whoami'
|
216 |
''')
|
217 |
+
|
218 |
+
print(f'''Quants available at https://huggingface.co/{whoami().get('name', None)}/{modelname}-exl2''')
|
exl2-multi-quant-local/exl2-multi-quant-local.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d8efd32962bf1a775796bb5ae0500c56f2e2f5fc43335734926edd89db858a2
|
3 |
+
size 6357
|
exl2-multi-quant-local/exl2-quant.py
CHANGED
@@ -71,6 +71,14 @@ qmount = int(input("Enter the number of quants you want to create: "))
|
|
71 |
qmount += 1
|
72 |
clear_screen()
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
#save bpw values
|
75 |
print(f"Type the BPW for the following {qmount - 1} quants. Recommend staying over 2.4 BPW. Use the vram calculator to find the best BPW values: https://huggingface.co/spaces/NyxKrage/LLM-Model-VRAM-Calculator")
|
76 |
qnum = {}
|
@@ -131,6 +139,12 @@ for bpw in bpwvalue:
|
|
131 |
subprocess.run(f"{oscp} {model}-exl2-{bpw}bpw-WD{slsh}measurement.json measurements{slsh}{model}-measure", shell=True) #copy measurement to measure directory
|
132 |
open(f"measurements{slsh}{model}-measure/Delete folder when no more quants are needed from this model", 'w').close()
|
133 |
subprocess.run(f"{osrmd} {model}-exl2-{bpw}bpw-WD", shell=True) #remove working directory
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
if tfound == 'false':
|
136 |
print(f'''
|
|
|
71 |
qmount += 1
|
72 |
clear_screen()
|
73 |
|
74 |
+
delmodel = input("Do you want to delete the original model after finishing? (Won't delete if canceled or failed) (y/n): ")
|
75 |
+
while delmodel != 'y' and delmodel != 'n':
|
76 |
+
delmodel = input("Please enter 'y' or 'n': ")
|
77 |
+
if delmodel == 'y':
|
78 |
+
print(f"Deleting dir models/{model} after quants are finished.")
|
79 |
+
time.sleep(3)
|
80 |
+
clear_screen()
|
81 |
+
|
82 |
#save bpw values
|
83 |
print(f"Type the BPW for the following {qmount - 1} quants. Recommend staying over 2.4 BPW. Use the vram calculator to find the best BPW values: https://huggingface.co/spaces/NyxKrage/LLM-Model-VRAM-Calculator")
|
84 |
qnum = {}
|
|
|
139 |
subprocess.run(f"{oscp} {model}-exl2-{bpw}bpw-WD{slsh}measurement.json measurements{slsh}{model}-measure", shell=True) #copy measurement to measure directory
|
140 |
open(f"measurements{slsh}{model}-measure/Delete folder when no more quants are needed from this model", 'w').close()
|
141 |
subprocess.run(f"{osrmd} {model}-exl2-{bpw}bpw-WD", shell=True) #remove working directory
|
142 |
+
|
143 |
+
if delmodel == 'y':
|
144 |
+
subprocess.run(f"{osrmd} models{slsh}{model}", shell=True)
|
145 |
+
print(f"Deleted models/{model}")
|
146 |
+
time.sleep(2)
|
147 |
+
clear_screen()
|
148 |
|
149 |
if tfound == 'false':
|
150 |
print(f'''
|