Saltar al contenido principal

TongyiZImageTurbo

GenerativeModel
DashAI.back.models.hugging_face.TongyiZImageTurbo

Tongyi Z-Image Turbo fast checkpoint.

Downloads its checkpoint into the component's own download folder.

Parameters

negative_prompt
num_inference_steps : integer, default=20
Number of denoising steps. Tongyi Z-Image achieves high quality results with 20-30 steps. More steps refine detail at the cost of generation time.
guidance_scale : number, default=5.0
Classifier-Free Guidance (CFG) scale. Controls how strictly the image follows the text prompt. Values 4-7 work well for Tongyi Z-Image.
device : string, default=CPU
Hardware device for inference. GPU is strongly recommended for this 6B parameter model. CPU inference is possible but very slow.
seed : integer, default=-1
Random seed for reproducible generation. A fixed positive integer always produces the same image. Use -1 for a random seed.
width : integer, default=1024
Width of the output image in pixels. Must be a multiple of 8. Tongyi Z-Image natively targets 1024x1024 px.
height : integer, default=1024
Height of the output image in pixels. Must be a multiple of 8. Tongyi Z-Image natively targets 1024x1024 px.
num_images_per_prompt : integer, default=1
How many images to generate from a single prompt in one batch. Requires proportionally more GPU memory per additional image.

Methods

component_dir(cls) -> pathlib.Path

Defined on DownloadableMixin

Return this component's own storage directory.

Returns

pathlib.Path
<COMPONENT_PATH>/<ClassName>.

delete(cls) -> None

Defined on DownloadableMixin

Remove the component's downloaded artifacts.

download(cls, report: Optional[Callable[[Optional[float], Optional[str]], NoneType]] = None) -> None

Defined on HFDownloadableMixin

Download all repos listed in hf_repos() into component_dir().

Parameters

report : ProgressReporter, optional
Callback invoked before each repo download with report(None, "Downloading <repo_id>"). None means no progress reporting.

generate(self, input: str) -> List[Any]

Defined on TongyiZImageGenerationModel

Generate images from a text prompt.

Parameters

input : str
Text prompt to generate an image from.

Returns

List[Any]
Generated output images in a list.

get_metadata(cls) -> Dict[str, Any]

Defined on BaseGenerativeModel

Get metadata values for the current generative model.

Returns

Dict[str, Any]
Dictionary indicating whether the model requires a download before use and the expected download size in bytes.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

hf_repos(cls)

Defined on HFPretrainedDownloadMixin

Derive the single repo entry from MODEL_NAME.

Returns

list of tuple of (str, str)
[(MODEL_NAME, "model")] or an empty list when unset.

is_downloaded(cls) -> bool

Defined on HFDownloadableMixin

Return whether all repo directories exist and are non-empty.

Returns

bool
True when every repo listed in hf_repos() has a non-empty local directory; False otherwise (including when the list is empty).

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.

Compatible with