Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +54 -0
- assets/teaser.png +3 -0
- demo_inference_release.py +2 -2
.gitattributes
CHANGED
|
@@ -33,4 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
assets/teaser.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -6,6 +6,7 @@ license_link: LICENSE
|
|
| 6 |
|
| 7 |
# Model Overview
|
| 8 |
|
|
|
|
| 9 |
## Description
|
| 10 |
|
| 11 |
NL-Diffusion-Image introduces a new paradigm for high-resolution text-to-image generation via LLM based on masked discrete diffusion over tokenized image patches.
|
|
@@ -17,6 +18,8 @@ We finetune from [Nemotron-Labs-Diffusion](https://huggingface.co/nvidia/Nemotro
|
|
| 17 |
|
| 18 |
This model is ready for research or non-commercial evaluation.
|
| 19 |
|
|
|
|
|
|
|
| 20 |
### License/Terms of Use
|
| 21 |
|
| 22 |
GOVERNING TERMS: Use of this model is governed by the [NVIDIA Open Source License Agreement](https://huggingface.co/nvidia/NL-Diffusion-Image/raw/main/LICENSE).
|
|
@@ -298,3 +301,54 @@ Model Application Field(s): | Generation of image
|
|
| 298 |
Describe the life critical impact (if present). | Not Applicable
|
| 299 |
Use Case Restrictions: | Research/evaluation only, non-commercial applications.
|
| 300 |
Model and dataset restrictions: | The Principle of least privilege (PoLP) is applied limiting access for dataset generation and model development. Restrictions enforce dataset access during training, and dataset license constraints adhered to.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Model Overview
|
| 8 |
|
| 9 |
+
|
| 10 |
## Description
|
| 11 |
|
| 12 |
NL-Diffusion-Image introduces a new paradigm for high-resolution text-to-image generation via LLM based on masked discrete diffusion over tokenized image patches.
|
|
|
|
| 18 |
|
| 19 |
This model is ready for research or non-commercial evaluation.
|
| 20 |
|
| 21 |
+
|
| 22 |
+

|
| 23 |
### License/Terms of Use
|
| 24 |
|
| 25 |
GOVERNING TERMS: Use of this model is governed by the [NVIDIA Open Source License Agreement](https://huggingface.co/nvidia/NL-Diffusion-Image/raw/main/LICENSE).
|
|
|
|
| 301 |
Describe the life critical impact (if present). | Not Applicable
|
| 302 |
Use Case Restrictions: | Research/evaluation only, non-commercial applications.
|
| 303 |
Model and dataset restrictions: | The Principle of least privilege (PoLP) is applied limiting access for dataset generation and model development. Restrictions enforce dataset access during training, and dataset license constraints adhered to.
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
## Quick Start
|
| 307 |
+
|
| 308 |
+
```
|
| 309 |
+
import torch
|
| 310 |
+
from transformers import AutoModelForCausalLM, PreTrainedTokenizerFast
|
| 311 |
+
|
| 312 |
+
model_path = "shufanlNvidia/NLD-Diffusion-Image-8B-Internal"
|
| 313 |
+
tokenizer = PreTrainedTokenizerFast.from_pretrained(model_path)
|
| 314 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 315 |
+
model_path,
|
| 316 |
+
trust_remote_code=True,
|
| 317 |
+
torch_dtype=torch.bfloat16,
|
| 318 |
+
)
|
| 319 |
+
model = model.to("cuda").eval()
|
| 320 |
+
model.config.dlm_paradigm = "bidirectional"
|
| 321 |
+
PROMPT = (
|
| 322 |
+
"A full-body shot of hyper-realistic female cyborg, human facial skin seamlessly integrated with a glossy white mechanical head shell. "
|
| 323 |
+
"Features a realistic human ear, blue eyes. bright, outdoor, background with blue sky, illuminated by striking bright white studio lighting, "
|
| 324 |
+
"casting soft shadows. Cyberpunk aesthetic, high-tech minimalism, shot on 85mm lens, photorealistic, Unreal Engine 5 render, intricately detailed, "
|
| 325 |
+
"8k resolution, high dynamic range, chest with whit armor plate, cute, beautiful, sexy, glossy surface, reflective, Artstation, pixiv, no hair, "
|
| 326 |
+
"3D render, stylized eyesz"
|
| 327 |
+
)
|
| 328 |
+
torch.manual_seed(42)
|
| 329 |
+
|
| 330 |
+
image = model.text_to_image(
|
| 331 |
+
PROMPT,
|
| 332 |
+
tokenizer=tokenizer,
|
| 333 |
+
image_resolution=1024,
|
| 334 |
+
n_tokens=(1024 // 16) * (1024 // 16),
|
| 335 |
+
guidance_scale=5.0,
|
| 336 |
+
temperature=0.86,
|
| 337 |
+
n_steps=64,
|
| 338 |
+
schedule="shift",
|
| 339 |
+
shift=5,
|
| 340 |
+
confidence_policy="mmada",
|
| 341 |
+
schedule_temp="linear",
|
| 342 |
+
alg_temp=1.0,
|
| 343 |
+
dynamic_temperature=False,
|
| 344 |
+
min_temperature=0.01,
|
| 345 |
+
edit_threshold=0.6,
|
| 346 |
+
micro_cond="ORIGINAL WIDTH : 1024; ORIGINAL HEIGHT : 1024; TOP : 0; LEFT : 0; SCORE : 6.520; HPS: 3.220",
|
| 347 |
+
block_policy=2,
|
| 348 |
+
is_legacy=False,
|
| 349 |
+
use_cache=False,
|
| 350 |
+
)
|
| 351 |
+
image.save("output.webp")
|
| 352 |
+
```
|
| 353 |
+
|
| 354 |
+
See [demo_inference_release.py](demo_inference_release.py) for more details of inference arguments.
|
assets/teaser.png
ADDED
|
Git LFS Details
|
demo_inference_release.py
CHANGED
|
@@ -9,7 +9,7 @@ from transformers import AutoModelForCausalLM, PreTrainedTokenizerFast
|
|
| 9 |
os.environ.setdefault("DEBUG_FIX_PADDING", "1")
|
| 10 |
os.environ.setdefault("NOT_ALWASY_DO_2DPOOL", "1")
|
| 11 |
|
| 12 |
-
DEFAULT_CKPT = "/
|
| 13 |
DEFAULT_PROMPT = (
|
| 14 |
"A full-body shot of hyper-realistic female cyborg, human facial skin seamlessly integrated with a glossy white mechanical head shell. "
|
| 15 |
"Features a realistic human ear, blue eyes. bright, outdoor, background with blue sky, illuminated by striking bright white studio lighting, "
|
|
@@ -17,7 +17,7 @@ DEFAULT_PROMPT = (
|
|
| 17 |
"8k resolution, high dynamic range, chest with whit armor plate, cute, beautiful, sexy, glossy surface, reflective, Artstation, pixiv, no hair, "
|
| 18 |
"3D render, stylized eyesz"
|
| 19 |
)
|
| 20 |
-
DEFAULT_OUTPUT = "/
|
| 21 |
|
| 22 |
SCHEDULE_CHOICES = ["shift"]
|
| 23 |
CONFIDENCE_POLICY_CHOICES = ["mask_git", "mmada", "stratified"]
|
|
|
|
| 9 |
os.environ.setdefault("DEBUG_FIX_PADDING", "1")
|
| 10 |
os.environ.setdefault("NOT_ALWASY_DO_2DPOOL", "1")
|
| 11 |
|
| 12 |
+
DEFAULT_CKPT = "/path/to/nemotron-labs-diffuion-image-8B-release"
|
| 13 |
DEFAULT_PROMPT = (
|
| 14 |
"A full-body shot of hyper-realistic female cyborg, human facial skin seamlessly integrated with a glossy white mechanical head shell. "
|
| 15 |
"Features a realistic human ear, blue eyes. bright, outdoor, background with blue sky, illuminated by striking bright white studio lighting, "
|
|
|
|
| 17 |
"8k resolution, high dynamic range, chest with whit armor plate, cute, beautiful, sexy, glossy surface, reflective, Artstation, pixiv, no hair, "
|
| 18 |
"3D render, stylized eyesz"
|
| 19 |
)
|
| 20 |
+
DEFAULT_OUTPUT = "/path/to/output/demo_inference_release.webp"
|
| 21 |
|
| 22 |
SCHEDULE_CHOICES = ["shift"]
|
| 23 |
CONFIDENCE_POLICY_CHOICES = ["mask_git", "mmada", "stratified"]
|