本项目是 Stanford BDHG 维护的 llama.cpp 的一个分支,专门用于使用 C/C++ 部署 LLaMA 模型。我们的修改将该库打包为 XCFramework,以便作为与多个平台二进制兼容的发布包。包含 Package.swift
文件方便了与 Swift Package Manager (SPM) 的集成。
注意
如果您对本分支所基于的 llama.cpp 代码库有任何疑问,请参阅 上游 llama.cpp 的 README,以获取全面的详细信息和指导。
您需要将 Stanford BDHG llama.cpp Swift 包添加到 您在 Xcode 中的应用程序 或 Swift 包。
重要提示
重要提示:为了使用该库,需要在使用的 Xcode 项目或使用的 SPM 包中设置构建参数,以启用 Xcode 15 和 Swift 5.9 中引入的 Swift / C++ 互操作。请记住,对于嵌套依赖项,需要为整个依赖项树(直到 llama.cpp SPM 包)递归地设置此配置。
对于 Xcode 项目
C++ and Objective-C Interoperability
设置,并将其设置为 C++ / Objective-C++
。这将使项目能够使用来自 llama.cpp 的 C++ 头文件。对于 SPM 包
Package.swift
文件target
中,添加类似以下的 interoperabilityMode(_:)
Swift 构建设置/// Adds the dependency to the Stanford BDHG llama.cpp SPM package
dependencies: [
.package(url: "https://github.com/StanfordBDHG/llama.cpp", .upToNextMinor(from: "0.1.0"))
],
targets: [
.target(
name: "ExampleConsumingTarget",
/// State the dependence of the target to llama.cpp
dependencies: [
.product(name: "llama", package: "llama.cpp")
],
/// Important: Configure the `.interoperabilityMode(_:)` within the `swiftSettings`
swiftSettings: [
.interoperabilityMode(.Cxx)
]
)
]
欢迎为本项目做出贡献。请务必先阅读 贡献指南 和 贡献者盟约行为准则。您可以在 CONTRIBUTORS.md
文件中找到贡献者列表。
本项目是现有项目的一个分支,该项目根据 MIT 许可证授权,并且在此分支中所做的所有更改继续遵循 MIT 许可证。有关许可证条款的更多信息,请参见 Licenses 文件夹。
有关更多信息,请访问我们的网站 biodesigndigitalhealth.stanford.edu。