mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
@@ -20,7 +20,13 @@ model = AutoModelForCausalLM.from_pretrained(
|
||||
dtype=torch.bfloat16,
|
||||
trust_remote_code=True,
|
||||
attn_implementation="sdpa",
|
||||
# attn_implementation="eager",
|
||||
# attn_implementation="flash_attention_2",
|
||||
)
|
||||
model.config.use_flash_attention = True
|
||||
|
||||
logger.log.info("OpenAI: eval model...")
|
||||
model.eval()
|
||||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
"Qwen/Qwen3-0.6B",
|
||||
trust_remote_code=True
|
||||
@@ -42,3 +48,4 @@ while True:
|
||||
except KeyboardInterrupt:
|
||||
server.stop()
|
||||
break
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from modules import shared, extra_networks, ui_video_vlm
|
||||
|
||||
|
||||
def prepare_prompt(p, init_image, prompt:str, vlm_enhance:bool, vlm_model:str, vlm_system_prompt:str):
|
||||
def prepare_prompts(p, init_image, prompt:str, vlm_enhance:bool, vlm_model:str, vlm_system_prompt:str):
|
||||
p.prompt = shared.prompt_styles.apply_styles_to_prompt(p.prompt, p.styles)
|
||||
p.negative_prompt = shared.prompt_styles.apply_negative_styles_to_prompt(p.negative_prompt, p.styles)
|
||||
shared.prompt_styles.apply_styles_to_extra(p)
|
||||
@@ -18,4 +18,7 @@ def prepare_prompt(p, init_image, prompt:str, vlm_enhance:bool, vlm_model:str, v
|
||||
)
|
||||
if new_prompt is not None and len(new_prompt) > 0:
|
||||
prompt = new_prompt
|
||||
return prompt
|
||||
|
||||
p.styles = []
|
||||
p.task_args['prompt'] = p.prompt
|
||||
p.task_args['negative_prompt'] = p.negative_prompt
|
||||
|
||||
@@ -95,12 +95,11 @@ def generate(*args, **kwargs):
|
||||
shared.sd_model = sd_models.apply_balanced_offload(shared.sd_model)
|
||||
devices.torch_gc(force=True, reason='video')
|
||||
|
||||
prompt = video_prompt.prepare_prompt(p, init_image, prompt, vlm_enhance, vlm_model, vlm_system_prompt)
|
||||
|
||||
# set args
|
||||
video_prompt.prepare_prompts(p, init_image, prompt, vlm_enhance, vlm_model, vlm_system_prompt)
|
||||
processing.fix_seed(p)
|
||||
video_vae.set_vae_params(p)
|
||||
video_utils.set_prompt(p)
|
||||
p.task_args['num_inference_steps'] = p.steps
|
||||
p.task_args['width'] = p.width
|
||||
p.task_args['height'] = p.height
|
||||
|
||||
@@ -30,15 +30,6 @@ def check_av():
|
||||
return av
|
||||
|
||||
|
||||
def set_prompt(p):
|
||||
p.prompt = shared.prompt_styles.apply_styles_to_prompt(p.prompt, p.styles)
|
||||
p.negative_prompt = shared.prompt_styles.apply_negative_styles_to_prompt(p.negative_prompt, p.styles)
|
||||
shared.prompt_styles.apply_styles_to_extra(p)
|
||||
p.styles = []
|
||||
p.task_args['prompt'] = p.prompt
|
||||
p.task_args['negative_prompt'] = p.negative_prompt
|
||||
|
||||
|
||||
def hijack_encode_image(*args, **kwargs):
|
||||
t0 = time.time()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user