mingyi456 commited on
Commit
7975b01
·
verified ·
1 Parent(s): ea65e9d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -3
README.md CHANGED
@@ -53,11 +53,26 @@ pattern_dict={
53
  2. To use the DFloat11 model, run the following example code in Python:
54
  ```python
55
  import torch
56
- from diffusers import Cosmos2TextToImagePipeline
57
  from dfloat11 import DFloat11Model
58
- pipe = Cosmos2TextToImagePipeline.from_pretrained("nvidia/Cosmos-Predict2-14B-Text2Image", torch_dtype=torch.bfloat16)
59
- pipe.enable_model_cpu_offload()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  DFloat11Model.from_pretrained("mingyi456/Cosmos-Predict2-14B-Text2Image-DF11", device='cpu', bfloat16_model=pipe.transformer)
 
61
  prompt = "A close-up shot captures a vibrant yellow scrubber vigorously working on a grimy plate, its bristles moving in circular motions to lift stubborn grease and food residue. The dish, once covered in remnants of a hearty meal, gradually reveals its original glossy surface. Suds form and bubble around the scrubber, creating a satisfying visual of cleanliness in progress. The sound of scrubbing fills the air, accompanied by the gentle clinking of the dish against the sink. As the scrubber continues its task, the dish transforms, gleaming under the bright kitchen lights, symbolizing the triumph of cleanliness over mess."
62
  negative_prompt = "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality."
63
  image = pipe(
 
53
  2. To use the DFloat11 model, run the following example code in Python:
54
  ```python
55
  import torch
56
+ from diffusers import Cosmos2TextToImagePipeline, CosmosTransformer3DModel
57
  from dfloat11 import DFloat11Model
58
+ from transformers.modeling_utils import no_init_weights
59
+
60
+ with no_init_weights():
61
+ transformer = CosmosTransformer3DModel.from_config(
62
+ CosmosTransformer3DModel.load_config(
63
+ "nvidia/Cosmos-Predict2-14B-Text2Image",
64
+ subfolder="transformer"
65
+ ),
66
+ torch_dtype=torch.bfloat16
67
+ ).to(torch.bfloat16)
68
+
69
+ pipe = Cosmos2TextToImagePipeline.from_pretrained(
70
+ "nvidia/Cosmos-Predict2-14B-Text2Image",
71
+ transformer=transformer,
72
+ torch_dtype=torch.bfloat16
73
+ )
74
  DFloat11Model.from_pretrained("mingyi456/Cosmos-Predict2-14B-Text2Image-DF11", device='cpu', bfloat16_model=pipe.transformer)
75
+ pipe.enable_model_cpu_offload()
76
  prompt = "A close-up shot captures a vibrant yellow scrubber vigorously working on a grimy plate, its bristles moving in circular motions to lift stubborn grease and food residue. The dish, once covered in remnants of a hearty meal, gradually reveals its original glossy surface. Suds form and bubble around the scrubber, creating a satisfying visual of cleanliness in progress. The sound of scrubbing fills the air, accompanied by the gentle clinking of the dish against the sink. As the scrubber continues its task, the dish transforms, gleaming under the bright kitchen lights, symbolizing the triumph of cleanliness over mess."
77
  negative_prompt = "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality."
78
  image = pipe(