Dan Flower commited on
Commit
ad8017c
Β·
1 Parent(s): 56c9041

troubleshooting model path issue

Browse files
Files changed (2) hide show
  1. model/download_model.py +0 -1
  2. streamlit_app.py +6 -6
model/download_model.py CHANGED
@@ -4,7 +4,6 @@ from huggingface_hub import hf_hub_download
4
  def main():
5
  MODEL_REPO = os.getenv("MODEL_REPO", "TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF")
6
  MODEL_FILE = os.getenv("MODEL_FILE", "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf")
7
- #MODEL_FILE = os.getenv("MODEL_FILE", "TinyLlama-1.1B-Chat-v1.0.Q4_K_M.gguf")
8
  MODEL_DIR = pathlib.Path(os.getenv("MODEL_DIR", "/tmp/models"))
9
  MODEL_PATH = MODEL_DIR / MODEL_FILE
10
 
 
4
  def main():
5
  MODEL_REPO = os.getenv("MODEL_REPO", "TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF")
6
  MODEL_FILE = os.getenv("MODEL_FILE", "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf")
 
7
  MODEL_DIR = pathlib.Path(os.getenv("MODEL_DIR", "/tmp/models"))
8
  MODEL_PATH = MODEL_DIR / MODEL_FILE
9
 
streamlit_app.py CHANGED
@@ -25,7 +25,7 @@ MODEL_PATH = "/tmp/models/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf"
25
  # Always run download_model.py for troubleshooting
26
  st.warning("Running model download step...")
27
 
28
- try:
29
  result = subprocess.run(
30
  ["python3", "model/download_model.py"],
31
  check=True,
@@ -47,8 +47,8 @@ except subprocess.CalledProcessError as e:
47
  st.text(e.stderr or "No stderr")
48
  st.stop()
49
 
50
- #end of temp code
51
- '''if not os.path.exists(MODEL_PATH):
52
  st.warning("Model not found. Downloading...")
53
  try:
54
  subprocess.run(["python3", "model/download_model.py"], check=True, capture_output=True)
@@ -58,10 +58,10 @@ except subprocess.CalledProcessError as e:
58
  st.text(f"Exit code: {e.returncode}")
59
  st.text(f"Command: {e.cmd}")
60
  st.text(f"Output: {e.output if hasattr(e, 'output') else 'N/A'}")
61
- st.stop()'''
62
 
63
- st.markdown("## πŸ“ /tmp/models content:")
64
- st.text('\n'.join(os.listdir("/tmp/models")))
65
 
66
  # Add local subdirectories to Python path
67
  sys.path.append(os.path.join(os.path.dirname(__file__), "modules"))
 
25
  # Always run download_model.py for troubleshooting
26
  st.warning("Running model download step...")
27
 
28
+ '''try:
29
  result = subprocess.run(
30
  ["python3", "model/download_model.py"],
31
  check=True,
 
47
  st.text(e.stderr or "No stderr")
48
  st.stop()
49
 
50
+ #end of temp code'''
51
+ if not os.path.exists(MODEL_PATH):
52
  st.warning("Model not found. Downloading...")
53
  try:
54
  subprocess.run(["python3", "model/download_model.py"], check=True, capture_output=True)
 
58
  st.text(f"Exit code: {e.returncode}")
59
  st.text(f"Command: {e.cmd}")
60
  st.text(f"Output: {e.output if hasattr(e, 'output') else 'N/A'}")
61
+ st.stop()
62
 
63
+ #st.markdown("## πŸ“ /tmp/models content:")
64
+ #st.text('\n'.join(os.listdir("/tmp/models")))
65
 
66
  # Add local subdirectories to Python path
67
  sys.path.append(os.path.join(os.path.dirname(__file__), "modules"))