MBG0903 commited on
Commit
1399876
·
verified ·
1 Parent(s): 3a1d648

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -24,7 +24,7 @@ DATA_PATH = Path(__file__).parent / "ai4i2020.csv"
24
 
25
  RANDOM_STATE = 42
26
  DECISION_THRESHOLD = 0.40
27
- LLM_MODEL_ID = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
28
 
29
  FEATURES = [
30
  "Type",
@@ -95,14 +95,17 @@ cm = confusion_matrix(y_test, test_predictions)
95
  # -------------------------------------------------------------------
96
  # Load the local instruction-tuned language model
97
  # -------------------------------------------------------------------
 
 
98
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
99
- TORCH_DTYPE = torch.float16 if DEVICE == "cuda" else torch.float32
100
 
101
- tokenizer = AutoTokenizer.from_pretrained(LLM_MODEL_ID)
 
 
102
 
103
  llm_model = AutoModelForCausalLM.from_pretrained(
104
  LLM_MODEL_ID,
105
- torch_dtype=TORCH_DTYPE,
106
  low_cpu_mem_usage=True,
107
  )
108
 
@@ -224,7 +227,7 @@ def generate_llm_reasoning(messages):
224
  with torch.inference_mode():
225
  output_ids = llm_model.generate(
226
  **inputs,
227
- max_new_tokens=500,
228
  do_sample=True,
229
  temperature=0.35,
230
  top_p=0.90,
 
24
 
25
  RANDOM_STATE = 42
26
  DECISION_THRESHOLD = 0.40
27
+ LLM_MODEL_ID = "Qwen/Qwen2.5-0.5B-Instruct"
28
 
29
  FEATURES = [
30
  "Type",
 
95
  # -------------------------------------------------------------------
96
  # Load the local instruction-tuned language model
97
  # -------------------------------------------------------------------
98
+ LLM_MODEL_ID = "Qwen/Qwen2.5-0.5B-Instruct"
99
+
100
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
 
101
 
102
+ tokenizer = AutoTokenizer.from_pretrained(
103
+ LLM_MODEL_ID
104
+ )
105
 
106
  llm_model = AutoModelForCausalLM.from_pretrained(
107
  LLM_MODEL_ID,
108
+ dtype=torch.float16 if DEVICE == "cuda" else torch.float32,
109
  low_cpu_mem_usage=True,
110
  )
111
 
 
227
  with torch.inference_mode():
228
  output_ids = llm_model.generate(
229
  **inputs,
230
+ max_new_tokens=220,
231
  do_sample=True,
232
  temperature=0.35,
233
  top_p=0.90,