0
0
Prompt Engineering / GenAIml~10 mins

Diffusion model concept in Prompt Engineering / GenAI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add noise to the data in a diffusion model step.

Prompt Engineering / GenAI
noisy_data = data + [1] * noise
Drag options to blanks, or click blank then click option'
A0.1
B1.0
C0.5
D2.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using noise scale too small like 0.1 which barely changes data
Using noise scale too large like 2.0 which overwhelms data
2fill in blank
medium

Complete the code to reverse the diffusion process by denoising the noisy data.

Prompt Engineering / GenAI
denoised_data = model.predict([1])
Drag options to blanks, or click blank then click option'
Alabels
Bdata
Cnoise
Dnoisy_data
Attempts:
3 left
💡 Hint
Common Mistakes
Passing original data instead of noisy data
Passing noise directly to the model
3fill in blank
hard

Fix the error in the training loss calculation for the diffusion model.

Prompt Engineering / GenAI
loss = loss_fn([1], predicted_noise)
Drag options to blanks, or click blank then click option'
Anoise
Bdenoised_data
Cnoisy_data
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using original data instead of noise in loss
Using noisy data instead of noise in loss
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each step to its noise level if the noise level is less than 0.5.

Prompt Engineering / GenAI
noise_levels = {step: [1] for step, noise in steps.items() if noise [2] 0.5}
Drag options to blanks, or click blank then click option'
Anoise
B>
C<
Dstep
Attempts:
3 left
💡 Hint
Common Mistakes
Using step as value instead of noise
Using > instead of < in condition
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps each step's name in uppercase to its noise value if noise is greater than 0.3.

Prompt Engineering / GenAI
filtered_noise = { [1]: [2] for step, [3] in steps.items() if noise > 0.3 }
Drag options to blanks, or click blank then click option'
Astep.upper()
Bnoise
Dstep
Attempts:
3 left
💡 Hint
Common Mistakes
Using step instead of step.upper() as key
Using step instead of noise as value
Swapping variable names in the loop