mingyang91 commited on
Commit
539e871
·
verified ·
1 Parent(s): 978cd83
Files changed (5) hide show
  1. Cargo.toml +7 -1
  2. Dockerfile +46 -0
  3. config/dev.yaml +1 -1
  4. src/config.rs +2 -3
  5. static/index.html +1 -1
Cargo.toml CHANGED
@@ -29,4 +29,10 @@ features = ["websocket", "static-files"]
29
 
30
  [target.aarch64-apple-darwin.dependencies.whisper-rs]
31
  version ="0.9.0-rc.2"
32
- features = ["coreml"]
 
 
 
 
 
 
 
29
 
30
  [target.aarch64-apple-darwin.dependencies.whisper-rs]
31
  version ="0.9.0-rc.2"
32
+ features = ["coreml"]
33
+
34
+ [target.x86_64-unknown-linux-gnu.dependencies.whisper-rs]
35
+ features = ["cuda"]
36
+
37
+ [target.aarch64-unknown-linux-gnu.dependencies.whisper-rs]
38
+ features = ["cuda"]
Dockerfile ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build stage
2
+ FROM nvidia/cuda:12.2.2-devel-ubuntu22.04 as builder
3
+
4
+ # Install python3.11 and build dependencies
5
+ RUN apt-get update
6
+ RUN apt-get install -y software-properties-common
7
+ #RUN add-apt-repository ppa:deadsnakes/ppa
8
+
9
+ RUN apt-get update
10
+ RUN apt-get install -y libssl-dev cmake python3-dev curl pkg-config clang
11
+
12
+ # install rust toolchain
13
+ RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
14
+ ENV PATH=/root/.cargo/bin:$PATH
15
+
16
+ # Just copy the manifest files to cache dependencies
17
+ COPY Cargo.toml Cargo.lock ./
18
+
19
+ # Download dependencies
20
+ RUN mkdir -p src/bin && echo "fn main() {println!(\"if you see this, the build broke\")}" > src/bin/bigbot.rs
21
+ RUN --mount=type=cache,target=/usr/local/cargo/registry \
22
+ --mount=type=cache,target=/usr/local/cargo/git \
23
+ cargo build --release
24
+
25
+ COPY ./src ./src
26
+
27
+ # Build the project with release profile
28
+ RUN --mount=type=cache,target=/usr/local/cargo/registry \
29
+ --mount=type=cache,target=/usr/local/cargo/git \
30
+ cargo build --release
31
+
32
+ # Runtime stage
33
+ FROM nvidia/cuda:12.2.2-runtime-ubuntu22.04 as runtime
34
+
35
+ # Install runtime dependencies
36
+ RUN apt-get update && apt-get install -y ca-certificates python3-dev && rm -rf /var/lib/apt/lists/*
37
+
38
+ # Just copy the binary from the build stage
39
+ COPY --from=builder /target/release/polyhedron /usr/local/bin/polyhedron
40
+ COPY ./models/ggml-large-encoder.mlmodelc ./models/ggml-large-encoder.mlmodelc
41
+ COPY ./models/ggml-large.bin ./models/ggml-large.bin
42
+ COPY config.yaml config.yaml
43
+ COPY ./static ./static
44
+
45
+ # Run the binary
46
+ CMD ["polyhedron"]
config/dev.yaml CHANGED
@@ -5,7 +5,7 @@ whisper:
5
  length_ms: 10000
6
  keep_ms: 200
7
  step_ms: 5000
8
- model: "models/ggml-medium.en.bin" #"models/ggml-base.bin"
9
  max_prompt_tokens: 128
10
  params:
11
  #n_threads: 4
 
5
  length_ms: 10000
6
  keep_ms: 200
7
  step_ms: 5000
8
+ model: "models/ggml-large-q5_0.bin" #"models/ggml-base.bin"
9
  max_prompt_tokens: 128
10
  params:
11
  #n_threads: 4
src/config.rs CHANGED
@@ -37,10 +37,8 @@ pub(crate) struct WhisperParams {
37
  pub(crate) language: Option<String>,
38
  }
39
 
40
- const _NONE: [c_int; 0] = [];
41
-
42
  impl WhisperParams {
43
- pub(crate) fn to_full_params<'a, 'b>(&'a self, _tokens: &'b [c_int]) -> FullParams<'a, 'b> {
44
  let mut param = FullParams::new(Default::default());
45
  param.set_print_progress(self.print_progress);
46
  param.set_print_special(self.print_special);
@@ -59,6 +57,7 @@ impl WhisperParams {
59
  param.set_speed_up(self.speed_up);
60
  // param.set_tdrz_enable(self.tinydiarize);
61
  param.set_temperature_inc(self.temperature_inc);
 
62
 
63
  param
64
  }
 
37
  pub(crate) language: Option<String>,
38
  }
39
 
 
 
40
  impl WhisperParams {
41
+ pub(crate) fn to_full_params<'a, 'b>(&'a self, tokens: &'b [c_int]) -> FullParams<'a, 'b> {
42
  let mut param = FullParams::new(Default::default());
43
  param.set_print_progress(self.print_progress);
44
  param.set_print_special(self.print_special);
 
57
  param.set_speed_up(self.speed_up);
58
  // param.set_tdrz_enable(self.tinydiarize);
59
  param.set_temperature_inc(self.temperature_inc);
60
+ param.set_tokens(tokens);
61
 
62
  param
63
  }
static/index.html CHANGED
@@ -5,7 +5,7 @@
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>Vite + React</title>
8
- <script type="module" crossorigin src="/assets/index-835823f8.js"></script>
9
  <link rel="stylesheet" href="/assets/index-983f9492.css">
10
  </head>
11
  <body>
 
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title>Vite + React</title>
8
+ <script type="module" crossorigin src="/assets/index-34871d29.js"></script>
9
  <link rel="stylesheet" href="/assets/index-983f9492.css">
10
  </head>
11
  <body>