wenjiao commited on
Commit
dd31174
1 Parent(s): 98b6126

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -20
app.py CHANGED
@@ -130,7 +130,7 @@ def update_Weight_Precision(temp_precisions):
130
  global current_precision
131
  global selected_dropdown_weight
132
 
133
-
134
  if set(current_precision) == set(temp_precisions):
135
  return [
136
  gr.Dropdown(choices=current_weightDtype, value=selected_dropdown_weight),
@@ -138,30 +138,21 @@ def update_Weight_Precision(temp_precisions):
138
  gr.CheckboxGroup(value=current_precision),
139
  gr.CheckboxGroup(value=current_quant),
140
  ] # No update needed
141
- if len(temp_precisions) > 1:
142
- selected_dropdown_weight = 'All'
143
- precisions = [precision for precision in temp_precisions if precision not in current_precision]
144
-
145
  selected_weight = []
146
  selected_compute = ['All', '?', 'int8', 'float16', 'bfloat16', 'float32']
147
  selected_quant = [t.to_str() for t in QuantType if t != QuantType.QuantType_None]
148
 
149
- if set(temp_precisions) == {"16bit", "32bit"}:
150
- selected_precisions = temp_precisions.copy()
151
- elif (temp_precisions == ["16bit"] or temp_precisions == ["32bit"]) and set(current_precision) == set(["16bit", "32bit"]):
152
- selected_precisions = temp_precisions
153
  else:
154
- if "16bit" in precisions or "32bit" in precisions:
155
- selected_precisions = precisions
156
- else:
157
- filtered_precisions = [p for p in temp_precisions if p not in ["16bit", "32bit"]]
158
- selected_precisions = filtered_precisions.copy()
159
-
160
- current_precision = selected_precisions
161
- # Apply logic: If current_precision contains "16bit" or "32bit" and other values, remove the other values
162
- if ("16bit" in current_precision or "32bit" in current_precision) and any(p not in ["16bit", "32bit"] for p in current_precision):
163
- current_precision = [p for p in current_precision if p in ["16bit", "32bit"]]
164
-
165
  # Map selected_precisions to corresponding weights
166
  for precision in current_precision:
167
  if precision in precision_to_dtype:
 
130
  global current_precision
131
  global selected_dropdown_weight
132
 
133
+ print('temp_precisions', temp_precisions)
134
  if set(current_precision) == set(temp_precisions):
135
  return [
136
  gr.Dropdown(choices=current_weightDtype, value=selected_dropdown_weight),
 
138
  gr.CheckboxGroup(value=current_precision),
139
  gr.CheckboxGroup(value=current_quant),
140
  ] # No update needed
141
+
 
 
 
142
  selected_weight = []
143
  selected_compute = ['All', '?', 'int8', 'float16', 'bfloat16', 'float32']
144
  selected_quant = [t.to_str() for t in QuantType if t != QuantType.QuantType_None]
145
 
146
+ if temp_precisions[-1] in ["16bit", "32bit"]:
147
+ selected_precisions = [p for p in temp_precisions if p in ["16bit", "32bit"]]
 
 
148
  else:
149
+ selected_precisions = [p for p in temp_precisions if p not in ["16bit", "32bit"]]
150
+
151
+ current_precision = list(set(selected_precisions))
152
+ if len(current_precision) > 1:
153
+ selected_dropdown_weight = 'All'
154
+
155
+ print('final', current_precision)
 
 
 
 
156
  # Map selected_precisions to corresponding weights
157
  for precision in current_precision:
158
  if precision in precision_to_dtype: