CAST
The fast, no-frills style transfer node that just takes images
- src_img
- style_img
- res_img
CAST is one of the friendliest nodes in the ComfyUI-StyleTransferPlus pack, and the easiest to describe: it's "Domain Enhanced Arbitrary Image Style Transfer via Contrastive Learning," a 2022 SIGGRAPH paper, wrapped as a single node that takes a content image, a style image, and a dropdown. That's it. No size knob, no crop toggle, no strength slider - it works at whatever resolution you feed it and returns the stylized result.
It's also fast, which is the whole point of the paper. CAST is built on an autoencoder with a contrastive-learning objective, which pushes the transfer to keep content structure recognizable rather than melting it into mush. That makes it a genuinely good first node to try in this pack if you just want a quick stylization that doesn't destroy your subject.
How it works
The architecture is a content autoencoder (AE) plus a style-aware decoder (Dec_B), trained with a contrastive loss so the output stays semantically close to the content while adopting the style's look. The node ships two variants:
- CAST - the standard model.
- UCAST - the "unified" variant from the follow-up paper ("A Unified Arbitrary Style Transfer Framework via Adaptive Contrastive Learning"), which adds an extra style-encoding branch. Same interface, slightly different look.
The model_arch dropdown is the only control you get. Try both - they're free once the weights are downloaded.
Inputs and outputs
src_img- content.style_img- style.model_arch-CASTorUCAST.
Output: res_img (IMAGE) → Preview/Save. That's the entire node. If you want resizing, do it upstream with an ImageScale node - CAST happily processes whatever dimensions come in.
Install - the fiddly part
The node itself installs like every other node in the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/FuouM/ComfyUI-StyleTransferPlus
or search ComfyUI-StyleTransferPlus in ComfyUI Manager and restart.
Then comes the paperwork. CAST needs three model files, two of them from a Google Drive link on the CAST_pytorch repo's Test section, one (vgg_normalised.pth) from its Train section:
ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/vgg_normalised.pth
ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/CAST_model/latest_net_AE.pth
ComfyUI/custom_nodes/ComfyUI-StyleTransferPlus/models/CAST_model/latest_net_Dec_B.pth
If you want the UCAST variant too, mirror that under models/UCAST_model/. The zip you unzip also contains latest_net_Dec_A.pth and test_opt.txt - the README says both are safe to delete; only latest_net_AE.pth and latest_net_Dec_B.pth are used.
Note the vgg_normalised.pth file is shared across CAST, EFDM, and TSSAT in this pack. Download it once, and three nodes light up.
Common issues
- Missing model file errors - the CAST/UCAST weights and
vgg_normalised.pthmust sit at the exact paths above, inside the custom node folder. That's the number one failure mode. - No stylization, just a tint - try the other
model_arch. CAST and UCAST genuinely produce different results, and the right one depends on your style image.
CAST is the "just works" node of the pack once the downloads are done: two images in, one dropdown, no tuning loop. If that's what you're after, start here.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| src_img | IMAGE | — | |
| style_img | IMAGE | — | |
| model_arch | COMBO | CAST | 2 options: CAST, UCAST |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| res_img | IMAGE | — |