Spaces:
Paused
Paused
Update finetune.py
Browse files- finetune.py +19 -2
finetune.py
CHANGED
@@ -168,8 +168,25 @@ old_state_dict = model.state_dict
|
|
168 |
model.state_dict = (
|
169 |
lambda self, *_, **__: get_peft_model_state_dict(self, old_state_dict())
|
170 |
).__get__(model, type(model))
|
171 |
-
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
model.save_pretrained(OUTPUT_DIR)
|
175 |
repo.push_to_hub(OUTPUT_DIR, commit_message="Ft model")
|
|
|
168 |
model.state_dict = (
|
169 |
lambda self, *_, **__: get_peft_model_state_dict(self, old_state_dict())
|
170 |
).__get__(model, type(model))
|
171 |
+
|
172 |
+
import gradio as gr
|
173 |
+
|
174 |
+
def train():
|
175 |
+
# Call your trainer's train() function here
|
176 |
+
trainer.train()
|
177 |
+
print("Training complete.") # optional message to display when training is done
|
178 |
+
|
179 |
+
iface = gr.Interface(
|
180 |
+
fn=train,
|
181 |
+
inputs=None,
|
182 |
+
outputs=None,
|
183 |
+
title="Training Interface",
|
184 |
+
description="Click the button to start training.",
|
185 |
+
theme="default",
|
186 |
+
layout="vertical",
|
187 |
+
allow_flagging=False,
|
188 |
+
allow_screenshot=False
|
189 |
+
)
|
190 |
|
191 |
model.save_pretrained(OUTPUT_DIR)
|
192 |
repo.push_to_hub(OUTPUT_DIR, commit_message="Ft model")
|