Skip to content

Commit

Permalink
refactor: 基于 causal-lm 重构 service/web-api/xtask
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Apr 25, 2024
1 parent 6a20fce commit 8d0efcb
Show file tree
Hide file tree
Showing 21 changed files with 620 additions and 1,495 deletions.
19 changes: 8 additions & 11 deletions Cargo.lock

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

9 changes: 9 additions & 0 deletions nvidia/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,12 @@ where
})
}
}

pub fn synchronize() {
cuda::init();
for i in 0..cuda::Device::count() {
cuda::Device::new(i as _)
.retain_primary()
.apply(|ctx| ctx.synchronize());
}
}
13 changes: 1 addition & 12 deletions service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,9 @@ common = { path = "../common" }
tensor = { path = "../tensor" }
tokenizer = { path = "../tokenizer" }
causal-lm = { path = "../causal-lm" }
transformer = { path = "../transformer" }
transformer-cpu = { path = "../transformer-cpu" }
transformer-nv = { path = "../nvidia/transformer", optional = true }
distributed = { path = "../nvidia/distributed", optional = true }
half.workspace = true
log.workspace = true
tokio.workspace = true

[build-dependencies]
search-cuda-tools.workspace = true

[dev-dependencies]
colored = "2.1"
tokio = { workspace = true, features = ["time"] }

[features]
nvidia = ["transformer-nv", "distributed"]
transformer-cpu = { path = "../transformer-cpu" }
12 changes: 0 additions & 12 deletions service/build.rs

This file was deleted.

10 changes: 1 addition & 9 deletions service/src/batcher.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
use crate::session::SessionContext;
use common::utok;
use std::sync::{
use std::sync::{
atomic::{
AtomicBool,
Ordering::{Acquire, Release},
},
Condvar, Mutex,
};
use tokio::sync::mpsc::UnboundedSender;

pub struct Task<Cache> {
pub ctx: SessionContext<Cache>,
pub responsing: UnboundedSender<utok>,
}

pub struct Batcher<T> {
queue: Mutex<Vec<T>>,
Expand Down
15 changes: 0 additions & 15 deletions service/src/cpu.rs

This file was deleted.

154 changes: 0 additions & 154 deletions service/src/dispatch.rs

This file was deleted.

Loading

0 comments on commit 8d0efcb

Please sign in to comment.