Allow building spin with cuda or metal support

Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
This commit is contained in:
Ryan Levick 2023-08-30 11:08:28 +02:00
parent aaf9875c81
commit 89c232c583
No known key found for this signature in database
5 changed files with 20 additions and 52 deletions

46
Cargo.lock generated
View File

@ -3342,12 +3342,7 @@ version = "0.2.0-dev"
source = "git+https://github.com/rustformers/llm?rev=2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663#2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663"
dependencies = [
"llm-base",
"llm-bloom",
"llm-gpt2",
"llm-gptj",
"llm-gptneox",
"llm-llama",
"llm-mpt",
"serde",
"tracing",
]
@ -3372,39 +3367,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "llm-bloom"
version = "0.2.0-dev"
source = "git+https://github.com/rustformers/llm?rev=2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663#2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663"
dependencies = [
"llm-base",
]
[[package]]
name = "llm-gpt2"
version = "0.2.0-dev"
source = "git+https://github.com/rustformers/llm?rev=2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663#2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663"
dependencies = [
"bytemuck",
"llm-base",
]
[[package]]
name = "llm-gptj"
version = "0.2.0-dev"
source = "git+https://github.com/rustformers/llm?rev=2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663#2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663"
dependencies = [
"llm-base",
]
[[package]]
name = "llm-gptneox"
version = "0.2.0-dev"
source = "git+https://github.com/rustformers/llm?rev=2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663#2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663"
dependencies = [
"llm-base",
]
[[package]]
name = "llm-llama"
version = "0.2.0-dev"
@ -3414,14 +3376,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "llm-mpt"
version = "0.2.0-dev"
source = "git+https://github.com/rustformers/llm?rev=2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663#2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663"
dependencies = [
"llm-base",
]
[[package]]
name = "llm-samplers"
version = "0.0.6"

View File

@ -99,13 +99,11 @@ outbound-redis-tests = []
config-provider-tests = []
outbound-pg-tests = []
outbound-mysql-tests = []
llm-metal = ["spin-trigger-http/llm-metal"]
llm-cublas = ["spin-trigger-http/llm-cublas"]
[workspace]
members = [
"crates/*",
"sdk/rust",
"sdk/rust/macro",
]
members = ["crates/*", "sdk/rust", "sdk/rust/macro"]
[workspace.dependencies]
tracing = { version = "0.1", features = ["log"] }

View File

@ -11,8 +11,9 @@ candle = { git = "https://github.com/huggingface/candle", rev = "b80348d22f8f0da
candle-nn = { git = "https://github.com/huggingface/candle", rev = "b80348d22f8f0dadb6cc4101bde031d5de69a9a5" }
chrono = "0.4.26"
llm = { git = "https://github.com/rustformers/llm", rev = "2f6ffd4435799ceaa1d1bcb5a8790e5b3e0c5663", features = [
"tokenizers-remote",
"llama",
] }
], default-features = false }
lru = "0.9.0"
num_cpus = "1"
rand = "0.8.5"
@ -26,3 +27,8 @@ tokenizers = "0.13.4"
tokio = { version = "1.32.0", features = ["macros", "sync"] }
tracing = { workspace = true }
uuid = { version = "1.4.1", features = ["v4"] }
[features]
default = []
metal = ["llm/metal"]
cublas = ["llm/cublas"]

View File

@ -46,3 +46,8 @@ spin-testing = { path = "../testing" }
[[bench]]
name = "baseline"
harness = false
[features]
default = []
llm-metal = ["spin-trigger/llm-metal"]
llm-cublas = ["spin-trigger/llm-cublas"]

View File

@ -46,3 +46,8 @@ spin-componentize = { workspace = true }
tempfile = "3.3.0"
toml = "0.5"
tokio = { version = "1.23", features = ["rt", "macros"] }
[features]
default = []
llm-metal = ["spin-llm/metal"]
llm-cublas = ["spin-llm/cublas"]