Commit
·
c9673cf
1
Parent(s):
a8307fa
stopped downloading the models
Browse files- hanlde_form_submit.py +0 -20
hanlde_form_submit.py
CHANGED
|
@@ -4,19 +4,6 @@ from time import time
|
|
| 4 |
import streamlit as st
|
| 5 |
from grouped_sampling import GroupedSamplingPipeLine, is_supported, UnsupportedModelNameException
|
| 6 |
|
| 7 |
-
from download_repo import download_pytorch_model
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
def is_downloaded(model_name: str) -> bool:
|
| 11 |
-
"""
|
| 12 |
-
Checks if the model is downloaded.
|
| 13 |
-
:param model_name: The name of the model to check.
|
| 14 |
-
:return: True if the model is downloaded, False otherwise.
|
| 15 |
-
"""
|
| 16 |
-
models_dir = "/root/.cache/huggingface/hub"
|
| 17 |
-
model_dir = os.path.join(models_dir, f"models--{model_name.replace('/', '--')}")
|
| 18 |
-
return os.path.isdir(model_dir)
|
| 19 |
-
|
| 20 |
|
| 21 |
def create_pipeline(model_name: str, group_size: int) -> GroupedSamplingPipeLine:
|
| 22 |
"""
|
|
@@ -25,13 +12,6 @@ def create_pipeline(model_name: str, group_size: int) -> GroupedSamplingPipeLine
|
|
| 25 |
:param group_size: The size of the groups to use.
|
| 26 |
:return: A pipeline with the given model name and group size.
|
| 27 |
"""
|
| 28 |
-
if not is_downloaded(model_name):
|
| 29 |
-
download_repository_start_time = time()
|
| 30 |
-
st.write(f"Starts downloading model: {model_name} from the internet.")
|
| 31 |
-
download_pytorch_model(model_name)
|
| 32 |
-
download_repository_end_time = time()
|
| 33 |
-
download_time = download_repository_end_time - download_repository_start_time
|
| 34 |
-
st.write(f"Finished downloading model: {model_name} from the internet in {download_time:,.2f} seconds.")
|
| 35 |
st.write(f"Starts creating pipeline with model: {model_name}")
|
| 36 |
pipeline_start_time = time()
|
| 37 |
pipeline = GroupedSamplingPipeLine(
|
|
|
|
| 4 |
import streamlit as st
|
| 5 |
from grouped_sampling import GroupedSamplingPipeLine, is_supported, UnsupportedModelNameException
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def create_pipeline(model_name: str, group_size: int) -> GroupedSamplingPipeLine:
|
| 9 |
"""
|
|
|
|
| 12 |
:param group_size: The size of the groups to use.
|
| 13 |
:return: A pipeline with the given model name and group size.
|
| 14 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
st.write(f"Starts creating pipeline with model: {model_name}")
|
| 16 |
pipeline_start_time = time()
|
| 17 |
pipeline = GroupedSamplingPipeLine(
|