blip2 model path

feature/visualize-tokens
toshiaki1729 2024-05-08 04:24:33 +09:00
parent cf55b2da61
commit d1a8edae13
3 changed files with 5 additions and 3 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
# Byte-compiled / optimized / DLL files
__pycache__/
config.json
.vscode/
.vscode/
models/

View File

@ -13,10 +13,10 @@ class BLIP2Captioning:
def load(self):
if self.model is None or self.processor is None:
self.processor = Blip2Processor.from_pretrained(
self.MODEL_REPO, cache_dir=paths.setting_model_path
self.MODEL_REPO, cache_dir=paths.model_path / "aesthetic"
)
self.model = Blip2ForConditionalGeneration.from_pretrained(
self.MODEL_REPO, cache_dir=paths.setting_model_path
self.MODEL_REPO, cache_dir=paths.model_path / "aesthetic"
).to(devices.device)
def unload(self):

View File

@ -13,5 +13,6 @@ class Paths(Singleton):
self.base_path:Path = base_dir_path()
self.script_path: Path = self.base_path / "scripts"
self.userscript_path: Path = self.base_path / "userscripts"
self.model_path = self.base_path / "models"
paths = Paths()