Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ModelZoo
LLaDA2.0-Uni
Commits
9370f444
Commit
9370f444
authored
May 20, 2026
by
raojy
💬
Browse files
Update run_Transformers_t2i_thin.py
parent
fe013ad8
Pipeline
#3641
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
run_Transformers_t2i_thin.py
run_Transformers_t2i_thin.py
+26
-0
No files found.
run_Transformers_t2i_thin.py
View file @
9370f444
import
torch
from
modelscope
import
AutoModelForCausalLM
,
AutoTokenizer
from
decoder
import
decode_vq_tokens
model_path
=
"inclusionAI/LLaDA2.0-Uni"
tokenizer
=
AutoTokenizer
.
from_pretrained
(
model_path
,
trust_remote_code
=
True
)
model
=
AutoModelForCausalLM
.
from_pretrained
(
model_path
,
device_map
=
"cuda"
,
torch_dtype
=
"bfloat16"
,
trust_remote_code
=
True
).
eval
()
model
.
tokenizer
=
tokenizer
# Generate image tokens with thinking process
result
=
model
.
generate_image
(
"A fox with thick, dense, fluffy fur in a winter setting, possibly surrounded by snow."
,
image_h
=
1024
,
image_w
=
1024
,
mode
=
"thinking"
,
steps
=
8
,
cfg_scale
=
2.0
,
thinking_steps
=
32
,
thinking_gen_length
=
4096
,
)
# Print thinking trace
print
(
"Thinking:"
,
result
[
"thinking"
])
# Decode to PIL image
image
=
decode_vq_tokens
(
result
[
"token_ids"
],
result
[
"h"
],
result
[
"w"
],
model_path
,
"cuda"
,
num_steps
=
8
,
decode_mode
=
"decoder-turbo"
,)
image
.
save
(
"output_thinking.png"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment