Spaces:
Running
on
Zero
Running
on
Zero
Start adding LoRA
Browse files
app.py
CHANGED
@@ -1,19 +1,27 @@
|
|
1 |
import spaces
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
-
from
|
|
|
|
|
|
|
5 |
import json
|
6 |
from datetime import datetime
|
7 |
from uuid import uuid4
|
8 |
import os
|
9 |
from pathlib import Path
|
10 |
-
|
11 |
from huggingface_hub import CommitScheduler
|
12 |
|
13 |
# TODO make it so that feedback is only saved on prev. example if user makes another obfuscation
|
14 |
# and changes slider but doesn't hit obfuscate
|
15 |
# TODO maybe make it save and reset if user hits submit feedback
|
16 |
# TODO sampling params for modles
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
MODEL_PATHS = {
|
19 |
"length_more": "hallisky/lora-length-long-llama-3-8b",
|
|
|
1 |
import spaces
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
+
from peft import PeftModel, PeftConfig
|
5 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
6 |
+
from IPython import embed
|
7 |
+
|
8 |
import json
|
9 |
from datetime import datetime
|
10 |
from uuid import uuid4
|
11 |
import os
|
12 |
from pathlib import Path
|
|
|
13 |
from huggingface_hub import CommitScheduler
|
14 |
|
15 |
# TODO make it so that feedback is only saved on prev. example if user makes another obfuscation
|
16 |
# and changes slider but doesn't hit obfuscate
|
17 |
# TODO maybe make it save and reset if user hits submit feedback
|
18 |
# TODO sampling params for modles
|
19 |
+
# TODO obfuscation ID?
|
20 |
+
|
21 |
+
# Converts text to the correct format for LoRA adapters in StyleRemix
|
22 |
+
def convert_data_to_format(text):
|
23 |
+
output = f"### Original: {text}\n ### Rewrite:"
|
24 |
+
return output
|
25 |
|
26 |
MODEL_PATHS = {
|
27 |
"length_more": "hallisky/lora-length-long-llama-3-8b",
|