Views
No views yet
pip install git+https://github.com/Disty0/diffusers1import torch
2from diffusers import NewbiePipeline
3from transformers import AutoModel
4
5device = "cuda"
6model_path = "Disty0/NewBie-image-Exp0.1-Diffusers"
7text_encoder_2 = AutoModel.from_pretrained(model_path, subfolder="text_encoder_2", trust_remote_code=True, torch_dtype=torch.bfloat16)
8pipe = NewbiePipeline.from_pretrained(model_path, text_encoder_2=text_encoder_2, torch_dtype=torch.bfloat16)
9del text_encoder_2
10
11# Enable memory optimizations.
12pipe.enable_model_cpu_offload(device=device)
13
14prompt = """
15 <character_1>
16 <n>$character_1$</n>
17 <gender>1girl</gender>
18 <appearance>chibi, red_eyes, blue_hair, long_hair, hair_between_eyes, head_tilt, tareme, closed_mouth</appearance>
19 <clothing>school_uniform, serafuku, white_sailor_collar, white_shirt, short_sleeves, red_neckerchief, bow, blue_skirt, miniskirt, pleated_skirt, blue_hat, mini_hat, thighhighs, grey_thighhighs, black_shoes, mary_janes</clothing>
20 <expression>happy, smile</expression>
21 <action>standing, holding, holding_briefcase</action>
22 <position>center_left</position>
23 </character_1>
24
25 <character_2>
26 <n>$character_2$</n>
27 <gender>1girl</gender>
28 <appearance>chibi, red_eyes, pink_hair, long_hair, very_long_hair, multi-tied_hair, open_mouth</appearance>
29 <clothing>school_uniform, serafuku, white_sailor_collar, white_shirt, short_sleeves, red_neckerchief, bow, red_skirt, miniskirt, pleated_skirt, hair_bow, multiple_hair_bows, white_bow, ribbon_trim, ribbon-trimmed_bow, white_thighhighs, black_shoes, mary_janes, bow_legwear, bare_arms</clothing>
30 <expression>happy, smile</expression>
31 <action>standing, holding, holding_briefcase, waving</action>
32 <position>center_right</position>
33 </character_2>
34
35 <general_tags>
36 <count>2girls, multiple_girls</count>
37 <style>anime_style, digital_art</style>
38 <background>white_background, simple_background</background>
39 <atmosphere>cheerful</atmosphere>
40 <quality>high_resolution, detailed</quality>
41 <objects>briefcase</objects>
42 <other>alternate_costume</other>
43 </general_tags>
44"""
45
46negative_prompt = "blurry, worst quality, low quality, deformed hands, bad anatomy, extra limbs, poorly drawn face, mutated, extra eyes, bad proportions"
47
48pipe.text_encoder_2 = pipe.text_encoder_2.to(device)
49image = pipe(
50 prompt,
51 negative_prompt=negative_prompt,
52 height=1024,
53 width=1024,
54 guidance_scale=2.5,
55 num_inference_steps=30,
56 generator=torch.manual_seed(42),
57).images[0]
58display(image)