amaltese commited on
Commit
200ca5f
·
verified ·
1 Parent(s): 0065e54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -1,9 +1,3 @@
1
- import spaces
2
-
3
- @spaces.GPU
4
- def my_gpu_function():
5
- # Your code here
6
-
7
  import gradio as gr
8
  import os
9
  import torch
@@ -23,6 +17,7 @@ from peft import (
23
  prepare_model_for_kbit_training,
24
  PeftModel
25
  )
 
26
 
27
  # Set environment variable for cache directory
28
  os.environ['TRANSFORMERS_CACHE'] = '/tmp/hf_cache'
@@ -75,6 +70,7 @@ def sample_from_csv(csv_file, sample_size=100):
75
 
76
  return Dataset.from_dict({"text": texts})
77
 
 
78
  def finetune_model(csv_file, sample_size=100, num_epochs=3, progress=gr.Progress()):
79
  """Fine-tune the model and return results"""
80
  # Check GPU
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import os
3
  import torch
 
17
  prepare_model_for_kbit_training,
18
  PeftModel
19
  )
20
+ import spaces
21
 
22
  # Set environment variable for cache directory
23
  os.environ['TRANSFORMERS_CACHE'] = '/tmp/hf_cache'
 
70
 
71
  return Dataset.from_dict({"text": texts})
72
 
73
+ @spaces.GPU
74
  def finetune_model(csv_file, sample_size=100, num_epochs=3, progress=gr.Progress()):
75
  """Fine-tune the model and return results"""
76
  # Check GPU