Skip to content

Commit

Permalink
build(llama): 添加 LLaMA 寒武纪实现
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Jun 20, 2024
1 parent c6b782e commit aef4f67
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 16 deletions.
35 changes: 26 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ members = [
"devices/nvidia",

"models/llama/common",
"models/llama/cpu",
"models/llama/nvidia",
"models/llama/nvidia-distributed",
"models/llama/common-cpu",
"models/llama/nvidia-gpu",
"models/llama/nvidia-gpu-distributed",
"models/llama/cambricon-mlu",
"models/mixtral/common",
"models/mixtral/cpu",
]
Expand All @@ -38,3 +39,6 @@ operators = { git = "https://github.com/YdrMaster/operators-rs", rev = "cac4307"
cuda = { git = "https://github.com/YdrMaster/cuda-driver", rev = "a4b3cf5" }
nccl = { git = "https://github.com/YdrMaster/cuda-driver", rev = "a4b3cf5" }
search-cuda-tools = { git = "https://github.com/YdrMaster/cuda-driver", rev = "a4b3cf5" }

cndrv = { git = "https://github.com/YdrMaster/cndrv", rev = "d94e170" }
search-neuware-tools = { git = "https://github.com/YdrMaster/cndrv", rev = "d94e170" }
14 changes: 14 additions & 0 deletions models/llama/cambricon-mlu/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "llama-cn"
version = "0.0.0"
edition = "2021"
authors = ["YdrMaster <[email protected]>"]

[dependencies]
common = { path = "../../../common" }
causal-lm = { path = "../../../causal-lm" }
llama = { path = "../common" }

[build-dependencies]
build-script-cfg.workspace = true
search-neuware-tools.workspace = true
9 changes: 9 additions & 0 deletions models/llama/cambricon-mlu/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fn main() {
use build_script_cfg::Cfg;
use search_neuware_tools::find_neuware_home;

let neuware = Cfg::new("detected_neuware");
if find_neuware_home().is_some() {
neuware.define();
}
}
1 change: 1 addition & 0 deletions models/llama/cambricon-mlu/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#![cfg(detected_neuware)]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ tokio.workspace = true

[dev-dependencies]
colored = "2.1"
llama-cpu = { path = "../models/llama/cpu" }
llama-cpu = { path = "../models/llama/common-cpu" }
7 changes: 4 additions & 3 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ web-api = { path = "../web-api" }

# models
llama = { path = "../models/llama/common" }
llama-cpu = { path = "../models/llama/cpu" }
llama-nv = { path = "../models/llama/nvidia", optional = true }
llama-nv-distributed = { path = "../models/llama/nvidia-distributed", optional = true }
llama-cpu = { path = "../models/llama/common-cpu" }
llama-nv = { path = "../models/llama/nvidia-gpu", optional = true }
llama-nv-distributed = { path = "../models/llama/nvidia-gpu-distributed", optional = true }
llama-cn = { path = "../models/llama/cambricon-mlu", optional = true }
mixtral = { path = "../models/mixtral/common" }
mixtral-cpu = { path = "../models/mixtral/cpu" }

Expand Down

0 comments on commit aef4f67

Please sign in to comment.