зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 13:06:04 +02:00
remove lavis from utils.py
Этот коммит содержится в:
родитель
3be4e6a114
Коммит
f96862eb04
@ -2,8 +2,7 @@ import glob
|
||||
import os
|
||||
from pandas import DataFrame
|
||||
import pooch
|
||||
from torch import device, cuda
|
||||
from lavis.models import load_model_and_preprocess
|
||||
|
||||
|
||||
|
||||
class DownloadResource:
|
||||
@ -107,35 +106,4 @@ if __name__ == "__main__":
|
||||
outdict = {}
|
||||
outdict = append_data_to_dict(mydict)
|
||||
df = dump_df(outdict)
|
||||
print(df.head(10))
|
||||
|
||||
|
||||
def load_model_base():
|
||||
summary_device = device("cuda" if cuda.is_available() else "cpu")
|
||||
summary_model, summary_vis_processors, _ = load_model_and_preprocess(
|
||||
name="blip_caption",
|
||||
model_type="base_coco",
|
||||
is_eval=True,
|
||||
device=summary_device,
|
||||
)
|
||||
return summary_model, summary_vis_processors
|
||||
|
||||
|
||||
def load_model_large():
|
||||
summary_device = device("cuda" if cuda.is_available() else "cpu")
|
||||
summary_model, summary_vis_processors, _ = load_model_and_preprocess(
|
||||
name="blip_caption",
|
||||
model_type="large_coco",
|
||||
is_eval=True,
|
||||
device=summary_device,
|
||||
)
|
||||
return summary_model, summary_vis_processors
|
||||
|
||||
|
||||
def load_model(model_type):
|
||||
select_model = {
|
||||
"base": load_model_base,
|
||||
"large": load_model_large,
|
||||
}
|
||||
summary_model, summary_vis_processors = select_model[model_type]()
|
||||
return summary_model, summary_vis_processors
|
||||
print(df.head(10))
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user