---
title: LaMa-bf16
canonical_url: "https://www.modelscope.cn/models/mlx-community/LaMa-bf16"
md_url: "https://www.modelscope.cn/models/mlx-community/LaMa-bf16.md"
repository: mlx-community/LaMa-bf16
last_updated: 2026-10-10
license: apache-2.0
pipeline_tag: image-to-image
tasks:
  - image-to-image
base_model:
  - advimman/lama
base_model_relation: finetune
parameters: 51.1M
tensor_type:
  - BF16
library_name:
  - mlx
  - safetensors
  - pytorch
frameworks:
  - pytorch
downloads: 20
stars: 0
tags:
  - mlx
  - inpainting
  - object-removal
  - lama
---

# LaMa-bf16

> LaMa-bf16 - mlx-community 在 ModelScope 开源的模型。mlx-community/LaMa-bf16

mlx-community/LaMa-bf16 是 ModelScope 魔搭社区上的 51.1M 参数image-to-image模型，采用 apache-2.0 许可，基于 advimman/lama 构建。

- **Repository**: mlx-community/LaMa-bf16
- **License**: apache-2.0
- **Tasks**: image-to-image
- **Parameters**: 51.1M
- **Base model**: advimman/lama
- **Tags**: mlx, inpainting, object-removal, lama
- **Downloads**: 20
- **Stars**: 0
- **Last updated**: 2026-10-10

Source: https://www.modelscope.cn/models/mlx-community/LaMa-bf16

---

# mlx-community/LaMa-bf16

> **Superseded — use [mlx-community/LaMa-fp32](https://huggingface.co/mlx-community/LaMa-fp32).**
> These bf16 weights cast large fills in colour photos pink/magenta:
> Big-LaMa can't take bf16 weight rounding (max_abs 7.5e-2 vs PyTorch on a
> colour fixture; fp32 5.0e-6). mlx-lama-swift ≥ 0.3.1 loads LaMa-fp32.

Big-LaMa FFC inpainting (quality tier), converted to Apple MLX (**bf16**) for the
[mlx-lama-swift](https://github.com/xocialize/mlx-lama-swift) Swift package (MLXEngine `imageInpaint`
/ Forge Erase). From-scratch MLX-Swift port of [advimman/lama](https://github.com/advimman/lama);
parity-locked vs PyTorch (predicted max_abs 3.2e-5 fp32).

**bf16, not fp16:** LaMa's Fast Fourier Convolution produces high-magnitude bottleneck activations
(~1e3); fp16 weight rounding collapses the model (mean err 0.55), while bf16's wider exponent range
preserves it (mean 4e-3, visually identical to fp32). Use bf16 or fp32 — not fp16.

```swift
import LaMa
let inpainter = try LaMaInpainter.fromPretrained(weightsPath, dtype: .bfloat16)
let filled = inpainter(sourceCGImage, mask: maskCGImage)  // white mask = remove
```
Weights: Apache-2.0 (advimman/lama). Port: MIT.
