I am new to Machine Learning and I would like to experiment with diffusion models. Since Mathematica offers the "Stable Diffusion V1" model, I tried to follow the guide provided here.
My environment is a MacBook Air M1, with only 8GB of unified memory, and I am using version: 14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)
While running the command that will generate an image based on the prompt, I get the following error (picture with the error also attached):
In[114]:=
prompt =
"funny photo of a cute fluffy cat enjoying a morning croissant and \
drinking coffee in a balcony with breathtaking view, 3d render, \
cinematic, hyperdetailed, cartoon, animation, pixar disney render";
img = netEvaluate[<|"Prompt" -> prompt|>]
During evaluation of In[114]:= NetGraph::netmem1: Insufficient memory to evaluate the network: at least 3.45 gigabytes are required but only 1.28 gigabytes are available for TargetDevice -> CPU. Try to set the BatchSize option to a value smaller than the current value of 32.
Out[115]= Failure["ConfirmationFailed", <|
"MessageTemplate" -> "`` encountered.",
"MessageParameters" :> {$Failed}, "ConfirmationType" -> "Confirm",
"Expression" :> $Failed, "Information" -> Null|>]
I've been unlucky in trying to see where I can actually decrease the batch size manually by investigating the options for iNetEvaluate
, i.e., this one: Options[iNetEvaluate ] = { TargetDevice -> "CPU", MaxIterations -> 51, RandomSeeding -> Automatic, "SnapshotRatio" -> 1 };
and add BatchSize->16
myself, but it still gives me the same error, which means that the actual batch size is unchanged.
Q: How can I adjust the batch size here, to be able to finally generate my image? Thanks in advance
Attachments: