Spaces:
Sleeping
Sleeping
Delete setup.py
Browse files
setup.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
from pathlib import Path
|
3 |
-
from urllib.request import urlretrieve
|
4 |
-
import streamlit as st
|
5 |
-
|
6 |
-
HOME_DIR = Path.home()
|
7 |
-
APP_CACHE = HOME_DIR / "olmo_demo"
|
8 |
-
|
9 |
-
OLMO_MODEL_FILE = os.environ.get("OLMO_MODEL_FILE", "OLMo-7B-Instruct-Q4_K_M.gguf")
|
10 |
-
OLMO_MODEL = APP_CACHE / OLMO_MODEL_FILE
|
11 |
-
|
12 |
-
def download_olmo_model(model_file: str | None = None, force=False) -> Path:
|
13 |
-
if not OLMO_MODEL.exists() or force:
|
14 |
-
if model_file is None:
|
15 |
-
model_file = OLMO_MODEL_FILE
|
16 |
-
olmo_model = OLMO_MODEL
|
17 |
-
else:
|
18 |
-
olmo_model = APP_CACHE / model_file
|
19 |
-
olmo_model_url = f"https://huggingface.co/ssec-uw/OLMo-7B-Instruct-GGUF/resolve/main/{model_file}"
|
20 |
-
|
21 |
-
st.info(f"Downloading model from {olmo_model_url} to {olmo_model}")
|
22 |
-
try:
|
23 |
-
APP_CACHE.mkdir(parents=True, exist_ok=True)
|
24 |
-
urlretrieve(olmo_model_url, olmo_model)
|
25 |
-
st.success("Download complete!")
|
26 |
-
except Exception as e:
|
27 |
-
st.error(f"Failed to download model: {str(e)}")
|
28 |
-
raise
|
29 |
-
return olmo_model
|
30 |
-
else:
|
31 |
-
st.info(f"Model already exists at {OLMO_MODEL}")
|
32 |
-
return OLMO_MODEL
|
33 |
-
|
34 |
-
if __name__ == "__main__":
|
35 |
-
download_olmo_model()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|