Spaces:
Sleeping
Sleeping
SivilTaram
commited on
Commit
•
3b2cf1a
1
Parent(s):
61aefa1
update files
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ import redirect as rd
|
|
11 |
import torch
|
12 |
import shutil
|
13 |
import os
|
|
|
14 |
|
15 |
|
16 |
css = """
|
@@ -110,15 +111,19 @@ Infer the date from context. Q: Today is the second day of the third month of 1
|
|
110 |
}
|
111 |
st.table(df)
|
112 |
|
|
|
|
|
|
|
|
|
113 |
# zip the final lora module
|
114 |
-
torch.save(final_lora, "lora/adapter_model.bin")
|
115 |
# create a zip file
|
116 |
-
shutil.make_archive("
|
117 |
with open("lora_module.zip", "rb") as fp:
|
118 |
btn = st.download_button(
|
119 |
label="📥 Download the final LoRA Module",
|
120 |
data=fp,
|
121 |
-
file_name="
|
122 |
mime="application/zip"
|
123 |
)
|
124 |
st.warning("The page will be refreshed once you click the download button.")
|
|
|
11 |
import torch
|
12 |
import shutil
|
13 |
import os
|
14 |
+
import uuid
|
15 |
|
16 |
|
17 |
css = """
|
|
|
111 |
}
|
112 |
st.table(df)
|
113 |
|
114 |
+
random_id = uuid.uuid4().hex
|
115 |
+
os.makedirs(f"lora/{random_id}")
|
116 |
+
# copy config file
|
117 |
+
shutil.copyfile("lora/adapter_config.json", f"lora/{random_id}/adapter_config.json")
|
118 |
# zip the final lora module
|
119 |
+
torch.save(final_lora, f"lora/{random_id}/adapter_model.bin")
|
120 |
# create a zip file
|
121 |
+
shutil.make_archive(f"lora_{random_id}", 'zip', f"lora/{random_id}")
|
122 |
with open("lora_module.zip", "rb") as fp:
|
123 |
btn = st.download_button(
|
124 |
label="📥 Download the final LoRA Module",
|
125 |
data=fp,
|
126 |
+
file_name=f"lora_{random_id}.zip",
|
127 |
mime="application/zip"
|
128 |
)
|
129 |
st.warning("The page will be refreshed once you click the download button.")
|