try improve colab (#366)
* try improve colab * try improve colab * try improve colab * try improve colab * try improve colab * try improve colab
This commit is contained in:
parent
e32f04da34
commit
2e543fb93f
@ -1 +1 @@
|
||||
version = '2.0.5'
|
||||
version = '2.0.8'
|
||||
|
||||
@ -32,6 +32,7 @@ def worker():
|
||||
print(e)
|
||||
|
||||
def progressbar(number, text):
|
||||
print(f'[Fooocus] {text}')
|
||||
outputs.append(['preview', (number, text, None)])
|
||||
|
||||
@torch.no_grad()
|
||||
|
||||
@ -28,9 +28,14 @@ def remove_pattern(x, pattern):
|
||||
|
||||
class FooocusExpansion:
|
||||
def __init__(self):
|
||||
use_fp16 = model_management.should_use_fp16()
|
||||
|
||||
self.tokenizer = AutoTokenizer.from_pretrained(fooocus_expansion_path)
|
||||
self.model = AutoModelForCausalLM.from_pretrained(fooocus_expansion_path)
|
||||
|
||||
if use_fp16:
|
||||
self.model.half()
|
||||
|
||||
load_device = model_management.text_encoder_device()
|
||||
offload_device = model_management.text_encoder_offload_device()
|
||||
self.patcher = ModelPatcher(self.model, load_device=load_device, offload_device=offload_device)
|
||||
@ -39,7 +44,7 @@ class FooocusExpansion:
|
||||
model=self.model,
|
||||
tokenizer=self.tokenizer,
|
||||
device='cpu',
|
||||
torch_dtype=torch.float32)
|
||||
torch_dtype=torch.float16 if use_fp16 else torch.float32)
|
||||
|
||||
print(f'Fooocus Expansion engine loaded.')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user