ml-stable-diffusion提供了 torch 到 coreml 的模型转换能力
--attention-implementation ORIGINAL
否则默认会用到自然语言引擎。
AMD Hackintosh torch 依赖了 Intel MKL 。可以用 amdfriend 对动态库或二进制打补丁。
coreml_model = ct.convert(
torchscript_module,
convert_to="mlprogram",
minimum_deployment_target=ct.target.macOS13,
inputs=_get_coreml_inputs(sample_inputs, args),
outputs=[ct.TensorType(name=name) for name in output_names],
compute_units=ct.ComputeUnit[args.compute_unit],
compute_precision=ct.precision.FLOAT32,
# skip_model_load=True,
)
整个流程搞定后 6800xt 可以 30 秒可以跑完 50 次迭代速度介于 M1 和 M2 之间。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.