Merge branch 'main' of github.com:ostris/ai-toolkit
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
|
from transformers import (
|
||||||
|
Qwen3VLForConditionalGeneration,
|
||||||
|
Qwen3VLMoeForConditionalGeneration,
|
||||||
|
AutoProcessor,
|
||||||
|
)
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from optimum.quanto import freeze
|
from optimum.quanto import freeze
|
||||||
@@ -21,7 +25,12 @@ class Qwen3VLCaptioner(BaseCaptioner):
|
|||||||
|
|
||||||
def load_model(self):
|
def load_model(self):
|
||||||
self.print_and_status_update("Loading Qwen3VL model")
|
self.print_and_status_update("Loading Qwen3VL model")
|
||||||
self.model = Qwen3VLForConditionalGeneration.from_pretrained(
|
ModelClass = (
|
||||||
|
Qwen3VLMoeForConditionalGeneration
|
||||||
|
if "B-A" in self.caption_config.model_name_or_path
|
||||||
|
else Qwen3VLForConditionalGeneration
|
||||||
|
)
|
||||||
|
self.model = ModelClass.from_pretrained(
|
||||||
self.caption_config.model_name_or_path,
|
self.caption_config.model_name_or_path,
|
||||||
dtype=self.torch_dtype,
|
dtype=self.torch_dtype,
|
||||||
device_map="cpu",
|
device_map="cpu",
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ class Logger:
|
|||||||
self.terminal.flush()
|
self.terminal.flush()
|
||||||
self.log.flush()
|
self.log.flush()
|
||||||
|
|
||||||
|
def isatty(self):
|
||||||
|
return self.terminal.isatty()
|
||||||
|
|
||||||
|
|
||||||
def setup_log_to_file(filename):
|
def setup_log_to_file(filename):
|
||||||
if get_accelerator().is_local_main_process:
|
if get_accelerator().is_local_main_process:
|
||||||
|
|||||||
Reference in New Issue
Block a user