qwerty45-uiop commited on
Commit
d6adb09
·
verified ·
1 Parent(s): e17660e

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +0 -51
src/streamlit_app.py CHANGED
@@ -51,49 +51,6 @@ def load_data():
51
  def extract_numeric_ram(ram) -> Optional[int]:
52
  if pd.isna(ram):
53
  return None
54
- def calculate_quantized_size(base_size_str: str, quantization: str) -> str:
55
- """Calculate quantized model size based on base size and quantization type"""
56
- try:
57
- # Extract numeric value and unit from base size
58
- import re
59
- match = re.match(r'(\d+(?:\.\d+)?)\s*(GB|MB)', base_size_str.upper())
60
- if not match:
61
- return base_size_str
62
-
63
- value, unit = float(match.group(1)), match.group(2)
64
- multiplier = QUANTIZATION_INFO[quantization]["multiplier"]
65
-
66
- # Calculate new size
67
- new_value = value * multiplier
68
-
69
- # Convert MB to GB if needed for better readability
70
- if unit == "MB" and new_value >= 1024:
71
- new_value = new_value / 1024
72
- unit = "GB"
73
- elif unit == "GB" and new_value < 1:
74
- new_value = new_value * 1024
75
- unit = "MB"
76
-
77
- # Format the result
78
- if new_value >= 10:
79
- return f"{new_value:.0f}{unit}"
80
- else:
81
- return f"{new_value:.1f}{unit}"
82
- except:
83
- return base_size_str
84
-
85
- def get_quantization_recommendations(ram_gb: int) -> List[str]:
86
- """Recommend best quantization options based on available RAM"""
87
- if ram_gb <= 2:
88
- return ["4bit"]
89
- elif ram_gb <= 4:
90
- return ["4bit", "8bit"]
91
- elif ram_gb <= 8:
92
- return ["4bit", "8bit"]
93
- elif ram_gb <= 16:
94
- return ["8bit", "fp16"]
95
- else:
96
- return ["fp16", "8bit", "4bit"]
97
 
98
  ram_str = str(ram).lower().replace(" ", "")
99
 
@@ -115,14 +72,7 @@ def get_quantization_recommendations(ram_gb: int) -> List[str]:
115
  return None
116
 
117
  # Streamlined LLM database with popular models and download sizes
118
-
119
- QUANTIZATION_INFO = {
120
- "fp16": {"multiplier": 1.0, "label": "FP16 (Full)", "description": "Best quality, largest size"},
121
- "8bit": {"multiplier": 0.5, "label": "8-bit", "description": "Good quality, 50% smaller"},
122
- "4bit": {"multiplier": 0.25, "label": "4-bit", "description": "Decent quality, 75% smaller"}
123
- }
124
  LLM_DATABASE = {
125
-
126
  "ultra_low": { # ≤2GB
127
  "general": [
128
  {"name": "TinyLlama-1.1B-Chat", "size": "637MB", "description": "Compact chat model"},
@@ -233,7 +183,6 @@ LLM_DATABASE = {
233
  }
234
  }
235
 
236
-
237
  # Enhanced LLM recommendation with performance tiers
238
  def recommend_llm(ram_str) -> Tuple[str, str, str, Dict[str, List[Dict]]]:
239
  """Returns (recommendation, performance_tier, additional_info, detailed_models)"""
 
51
  def extract_numeric_ram(ram) -> Optional[int]:
52
  if pd.isna(ram):
53
  return None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  ram_str = str(ram).lower().replace(" ", "")
56
 
 
72
  return None
73
 
74
  # Streamlined LLM database with popular models and download sizes
 
 
 
 
 
 
75
  LLM_DATABASE = {
 
76
  "ultra_low": { # ≤2GB
77
  "general": [
78
  {"name": "TinyLlama-1.1B-Chat", "size": "637MB", "description": "Compact chat model"},
 
183
  }
184
  }
185
 
 
186
  # Enhanced LLM recommendation with performance tiers
187
  def recommend_llm(ram_str) -> Tuple[str, str, str, Dict[str, List[Dict]]]:
188
  """Returns (recommendation, performance_tier, additional_info, detailed_models)"""