-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathPackage.swift
More file actions
123 lines (121 loc) · 5.59 KB
/
Package.swift
File metadata and controls
123 lines (121 loc) · 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "SwiftLM",
platforms: [.macOS(.v14), .iOS(.v17)],
products: [
.library(name: "MLXInferenceCore", targets: ["MLXInferenceCore"]),
.library(name: "DFlash", targets: ["DFlash"]),
.executable(name: "SwiftLM", targets: ["SwiftLM"]),
.executable(name: "SwiftBuddy", targets: ["SwiftBuddy"]),
.executable(name: "DFlashKernelBench", targets: ["DFlashKernelBench"])
],
dependencies: [
// Local Apple MLX Swift fork for C++ extensions
.package(path: "./mlx-swift"),
// Apple's LLM library built on MLX Swift (SharpAI fork — with GPU/CPU layer partitioning)
.package(path: "./mlx-swift-lm"),
// HuggingFace tokenizers + model download
.package(url: "https://github.com/huggingface/swift-transformers", .upToNextMinor(from: "1.2.0")),
// Lightweight HTTP server (Apple-backed Swift server project)
.package(url: "https://github.com/hummingbird-project/hummingbird", from: "2.0.0"),
// Async argument parser (for CLI flags: --model, --port)
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"),
// SwiftSoup for HTML parsing
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.7.0"),
],
targets: [
// ── CLI HTTP server (macOS only) ──────────────────────────────
.executableTarget(
name: "SwiftLM",
dependencies: [
"MLXInferenceCore",
"DFlash",
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXLLM", package: "mlx-swift-lm"),
.product(name: "MLXVLM", package: "mlx-swift-lm"),
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
.product(name: "MLXHuggingFace", package: "mlx-swift-lm"),
.product(name: "Transformers", package: "swift-transformers"),
.product(name: "Hummingbird", package: "hummingbird"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
],
path: "Sources/SwiftLM"
),
// ── DFlash Kernel Micro-Benchmark ───────────────────────────
.executableTarget(
name: "DFlashKernelBench",
dependencies: [
"DFlash",
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXNN", package: "mlx-swift"),
],
path: "Sources/DFlashKernelBench"
),
// ── STFT Audio Profiling Testing Script (macOS only) ───────────
.executableTarget(
name: "SwiftLMTestSTFT",
dependencies: [
"MLXInferenceCore",
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXVLM", package: "mlx-swift-lm"),
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
],
path: "Sources/SwiftLMTestSTFT",
exclude: ["ground_truth.py"]
),
// ── macOS GUI App (SwiftBuddy) ──────────────────────────────
.executableTarget(
name: "SwiftBuddy",
dependencies: [
"MLXInferenceCore",
.product(name: "Hummingbird", package: "hummingbird"),
.product(name: "SwiftSoup", package: "SwiftSoup"),
],
path: "SwiftBuddy/SwiftBuddy",
exclude: [
"Assets.xcassets",
"SwiftBuddy.entitlements",
"Personas/Lumina.json"
]
),
// ── Shared inference library for SwiftLM Chat (iOS + macOS) ──
.target(
name: "MLXInferenceCore",
dependencies: [
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXLLM", package: "mlx-swift-lm"),
.product(name: "MLXVLM", package: "mlx-swift-lm"),
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
.product(name: "MLXHuggingFace", package: "mlx-swift-lm"),
.product(name: "Hub", package: "swift-transformers"),
.product(name: "Tokenizers", package: "swift-transformers"),
],
path: "Sources/MLXInferenceCore",
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
),
// ── DFlash Speculative Decoding ─────────────────────────────
.target(
name: "DFlash",
dependencies: [
.product(name: "MLX", package: "mlx-swift"),
.product(name: "MLXLLM", package: "mlx-swift-lm"),
.product(name: "MLXLMCommon", package: "mlx-swift-lm"),
],
path: "Sources/DFlash",
exclude: ["DFlashKernelsOptimized.swift"]
),
// ── Automated Test Harness ──────────────────────────────────
.testTarget(
name: "SwiftBuddyTests",
dependencies: ["SwiftBuddy", "MLXInferenceCore"]
),
.testTarget(
name: "SwiftLMTests",
dependencies: ["SwiftLM"]
)
]
)