haxerwddle commited on
Commit
64a735d
·
1 Parent(s): 14c97c3

Model prompt change

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -27,7 +27,9 @@ tiny_model = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
27
  tokenizer = AutoTokenizer.from_pretrained(tiny_model)
28
  chat_model = AutoModelForCausalLM.from_pretrained(
29
  tiny_model,
30
- torch_dtype=torch.float32)
 
 
31
 
32
  pipe = pipeline(
33
  "text-generation",
@@ -73,6 +75,7 @@ def explain_recycling(class_label):
73
 
74
  outputs = pipe(
75
  prompt,
 
76
  do_sample=True,
77
  temperature=0.3,
78
  top_p=0.9
@@ -192,7 +195,7 @@ with gr.Blocks() as demo:
192
  num_top_classes=3,
193
  label="🔍 Classifier Prediction (Top 3)"
194
  )
195
- analyze_btn = gr.Button("Analyze Waste", variant="primary")
196
 
197
  analyze_btn.click(
198
  classify_pipeline,
 
27
  tokenizer = AutoTokenizer.from_pretrained(tiny_model)
28
  chat_model = AutoModelForCausalLM.from_pretrained(
29
  tiny_model,
30
+ torch_dtype=torch.bfloat16,
31
+ device_map="auto",
32
+ low_cpu_mem_usage=True)
33
 
34
  pipe = pipeline(
35
  "text-generation",
 
75
 
76
  outputs = pipe(
77
  prompt,
78
+ max_new_tokens=60,
79
  do_sample=True,
80
  temperature=0.3,
81
  top_p=0.9
 
195
  num_top_classes=3,
196
  label="🔍 Classifier Prediction (Top 3)"
197
  )
198
+ analyze_btn = gr.Button("Classify Waste", variant="primary")
199
 
200
  analyze_btn.click(
201
  classify_pipeline,