qwerty45-uiop commited on
Commit
98ae49c
Β·
verified Β·
1 Parent(s): 1d3d953

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +9 -38
src/streamlit_app.py CHANGED
@@ -51,25 +51,9 @@ def load_data():
51
  def extract_numeric_ram(ram) -> Optional[int]:
52
  if pd.isna(ram):
53
  return None
54
- def calculate_quantized_sizes(model_size_str: str) -> Tuple[str, str, str]:
55
- """
56
- Given a model size like '13GB', calculate its 8-bit and 4-bit equivalents.
57
- Returns a tuple of (FP16, 8-bit, 4-bit) sizes as strings.
58
- """
59
- try:
60
- size_str = model_size_str.lower().strip()
61
- if "mb" in size_str:
62
- num = float(size_str.replace("mb", "")) / 1024 # Convert MB to GB
63
- else:
64
- num = float(size_str.replace("gb", ""))
65
-
66
- fp16 = num
67
- q8 = fp16 * 0.5
68
- q4 = fp16 * 0.25
69
- return f"{fp16:.1f} GB", f"{q8:.1f} GB", f"{q4:.1f} GB"
70
- except:
71
- return model_size_str, "-", "-"
72
-
73
  # Handle various formats: "8GB", "8 GB", "8gb", "8192MB", etc.
74
  gb_match = re.search(r"(\d+(?:\.\d+)?)(?:gb|g)", ram_str)
75
  if gb_match:
@@ -321,7 +305,7 @@ def display_model_categories(models_dict: Dict[str, List[Dict]], ram_gb: int):
321
  with col1:
322
  st.markdown(f"**{model['name']}**")
323
  with col2:
324
- st.markdown(f"`{model['size']}`")
325
  with col3:
326
  st.markdown(f"*{model['description']}*")
327
 
@@ -606,6 +590,7 @@ if selected_ram_key in LLM_DATABASE and selected_category in LLM_DATABASE[select
606
  st.caption("Download Size")
607
  with col3:
608
  st.markdown(f"*{model['description']}*")
 
609
  if "Llama" in model['name']:
610
  st.caption("πŸ”— Available on Hugging Face & Ollama")
611
  elif "Mistral" in model['name']:
@@ -614,24 +599,10 @@ if selected_ram_key in LLM_DATABASE and selected_category in LLM_DATABASE[select
614
  st.caption("πŸ”— Available on Hugging Face & Google")
615
  else:
616
  st.caption("πŸ”— Available on Hugging Face")
617
-
618
- # πŸ”½ Quantization size details
619
- fp16, q8, q4 = calculate_quantized_sizes(model['size'])
620
- with st.expander("πŸ’Ύ Quantized Size Estimates"):
621
- st.markdown(f"""
622
- | Format | Size |
623
- |--------|------|
624
- | FP16 (Full Precision) | **{fp16}** |
625
- | 8-bit Quantized | **{q8}** |
626
- | 4-bit Quantized | **{q4}** |
627
- """)
628
-
629
- st.markdown("---") # βœ… this belongs inside the if block
630
-
631
  else:
632
  st.info(f"No {selected_category} models available for {selected_ram_range}")
633
 
634
-
635
  # Enhanced reference guide
636
  with st.expander("πŸ“˜ Model Guide & Download Information"):
637
  st.markdown("""
@@ -688,10 +659,10 @@ with st.expander("πŸ“˜ Model Guide & Download Information"):
688
  - **AWQ**: Advanced weight quantization
689
 
690
  ### **Download Tips**
691
- - Use `git lfs` for large models from Hugging Face
692
  - Consider bandwidth and storage before downloading
693
  - Start with 4-bit quantized versions for testing
694
- - Use `ollama pull model_name` for easiest setup
695
 
696
  ## πŸ”§ Optimization Strategies
697
 
@@ -711,7 +682,7 @@ st.markdown("---")
711
  st.markdown("""
712
  ### πŸ”— Essential Download & Deployment Tools
713
  **πŸ“¦ Easy Model Deployment:**
714
- - [**Ollama**](https://ollama.ai/) – `curl -fsSL https://ollama.ai/install.sh | sh`
715
  - [**LM Studio**](https://lmstudio.ai/) – Drag-and-drop GUI for running models locally
716
  - [**GPT4All**](https://gpt4all.io/) – Cross-platform desktop app for local LLMs
717
  **πŸ€— Model Repositories:**
 
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
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  # Handle various formats: "8GB", "8 GB", "8gb", "8192MB", etc.
58
  gb_match = re.search(r"(\d+(?:\.\d+)?)(?:gb|g)", ram_str)
59
  if gb_match:
 
305
  with col1:
306
  st.markdown(f"**{model['name']}**")
307
  with col2:
308
+ st.markdown(f"{model['size']}")
309
  with col3:
310
  st.markdown(f"*{model['description']}*")
311
 
 
590
  st.caption("Download Size")
591
  with col3:
592
  st.markdown(f"*{model['description']}*")
593
+ # Add download suggestion
594
  if "Llama" in model['name']:
595
  st.caption("πŸ”— Available on Hugging Face & Ollama")
596
  elif "Mistral" in model['name']:
 
599
  st.caption("πŸ”— Available on Hugging Face & Google")
600
  else:
601
  st.caption("πŸ”— Available on Hugging Face")
602
+ st.markdown("---")
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  else:
604
  st.info(f"No {selected_category} models available for {selected_ram_range}")
605
 
 
606
  # Enhanced reference guide
607
  with st.expander("πŸ“˜ Model Guide & Download Information"):
608
  st.markdown("""
 
659
  - **AWQ**: Advanced weight quantization
660
 
661
  ### **Download Tips**
662
+ - Use git lfs for large models from Hugging Face
663
  - Consider bandwidth and storage before downloading
664
  - Start with 4-bit quantized versions for testing
665
+ - Use ollama pull model_name for easiest setup
666
 
667
  ## πŸ”§ Optimization Strategies
668
 
 
682
  st.markdown("""
683
  ### πŸ”— Essential Download & Deployment Tools
684
  **πŸ“¦ Easy Model Deployment:**
685
+ - [**Ollama**](https://ollama.ai/) – curl -fsSL https://ollama.ai/install.sh | sh
686
  - [**LM Studio**](https://lmstudio.ai/) – Drag-and-drop GUI for running models locally
687
  - [**GPT4All**](https://gpt4all.io/) – Cross-platform desktop app for local LLMs
688
  **πŸ€— Model Repositories:**