mlboydaisuke commited on
Commit
8d837d2
·
verified ·
1 Parent(s): a1e30b2

Add model card

Browse files
Files changed (1) hide show
  1. README.md +83 -0
README.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: coreml
4
+ pipeline_tag: image-to-image
5
+ tags:
6
+ - coreml
7
+ - core-ml
8
+ - ios
9
+ - macos
10
+ - apple
11
+ - on-device
12
+ - inpainting
13
+ - fourier-convolution
14
+ - arxiv:2109.07161
15
+ ---
16
+
17
+ # LaMa — Core ML
18
+
19
+ *Image Inpainting, 2022*
20
+
21
+ Resolution-robust large mask inpainting. Draw over unwanted objects to remove them. Fast Fourier convolutions for global context. 800×800 input.
22
+
23
+ Core ML conversion of [advimman/lama](https://github.com/advimman/lama) for on-device inference on iPhone, iPad and Mac. Converted with `coremltools`; the packages are stateless, so all sequencing and buffering lives in your Swift code.
24
+
25
+ | | |
26
+ |---|---|
27
+ | Task | image to image |
28
+ | Upstream | [advimman/lama](https://github.com/advimman/lama) |
29
+ | Packages | 1 |
30
+ | Download size | 187 MB |
31
+ | Minimum iOS | 17.0 |
32
+ | Peak RAM | ~600 MB |
33
+
34
+ ## Files
35
+
36
+ | File | Size | Compute units | SHA-256 |
37
+ |---|---:|---|---|
38
+ | `LaMa.mlpackage.zip` | 187 MB | `all` | `b57b8451a1a86c00…` |
39
+ | **Total** | **187 MB** | | |
40
+
41
+ `compute_units` is not a suggestion -- it is the configuration the conversion was verified against. Moving a package to a different compute unit can silently change the numerics (FP16 attention overflow) or crash on the GPU.
42
+
43
+ ## Download
44
+
45
+ ```bash
46
+ hf download mlboydaisuke/coreml-zoo --include "lama/*" --local-dir ./lama
47
+ unzip './lama/lama/*.zip' -d ./lama
48
+ ```
49
+
50
+ ## Use in Swift
51
+
52
+ ```swift
53
+ import CoreML
54
+
55
+ let config = MLModelConfiguration()
56
+ config.computeUnits = .all // as converted — see the table above
57
+
58
+ // Unzip the .mlpackage, drop it into your Xcode target and Xcode compiles it
59
+ // at build time:
60
+ let model = try LaMa(configuration: config)
61
+
62
+ // ...or compile a downloaded .mlpackage at runtime:
63
+ let compiled = try await MLModel.compileModel(at: mlpackageURL)
64
+ let model = try MLModel(contentsOf: compiled, configuration: config)
65
+ ```
66
+
67
+ ## Demo
68
+
69
+ - **Models Zoo** — this model is downloadable and runnable inside the [Models Zoo app](https://apps.apple.com/app/id6762083207) on the App Store, no build required.
70
+
71
+ ## Conversion
72
+
73
+ - Pitfalls hit during conversion (FP16 overflow, ANE buffer limits, stride handling): [`docs/coreml_conversion_notes.md`](https://github.com/john-rocky/CoreML-Models/blob/master/docs/coreml_conversion_notes.md)
74
+ - Model index: [CoreML-Models](https://github.com/john-rocky/CoreML-Models)
75
+
76
+ ## License
77
+
78
+ The conversion inherits the upstream license: **Apache-2.0**.
79
+
80
+ ## Credits
81
+
82
+ - Upstream authors: [advimman/lama](https://github.com/advimman/lama), 2022
83
+ - Core ML conversion: john-rocky (Daisuke Majima)