Add quantize option to from_alias initializer
This commit is contained in:
parent
af73966f11
commit
c0d419777e
@ -97,10 +97,13 @@ import sys
|
|||||||
sys.path.append("/path/to/mflux/src")
|
sys.path.append("/path/to/mflux/src")
|
||||||
|
|
||||||
from mflux.config.config import Config
|
from mflux.config.config import Config
|
||||||
from mflux.flux import Flux1
|
from mflux.flux.flux import Flux1
|
||||||
|
|
||||||
# Load the model
|
# Load the model
|
||||||
flux = Flux1.from_alias(alias="schnell") # "schnell" or "dev"
|
flux = Flux1.from_alias(
|
||||||
|
alias="schnell", # "schnell" or "dev"
|
||||||
|
quantize=8, # 4 or 8
|
||||||
|
)
|
||||||
|
|
||||||
# Generate an image
|
# Generate an image
|
||||||
image = flux.generate_image(
|
image = flux.generate_image(
|
||||||
|
|||||||
@ -126,8 +126,11 @@ class Flux1:
|
|||||||
return latents
|
return latents
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_alias(alias: str) -> "Flux1":
|
def from_alias(alias: str, quantize: int | None = None) -> "Flux1":
|
||||||
return Flux1(ModelConfig.from_alias(alias))
|
return Flux1(
|
||||||
|
model_config=ModelConfig.from_alias(alias),
|
||||||
|
quantize=quantize,
|
||||||
|
)
|
||||||
|
|
||||||
def _set_model_weights(self, weights):
|
def _set_model_weights(self, weights):
|
||||||
self.vae.update(weights.vae)
|
self.vae.update(weights.vae)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user