Matrix commited on
Commit
095a7fa
·
2 Parent(s): 65f3e54 1e346b2

Merge remote-tracking branch 'origin/master'

Browse files
Files changed (6) hide show
  1. Cargo.lock +4 -4
  2. Cargo.toml +15 -4
  3. Dockerfile +46 -0
  4. config/dev.yaml +1 -1
  5. src/config.rs +2 -3
  6. static/index.html +1 -1
Cargo.lock CHANGED
@@ -2456,18 +2456,18 @@ dependencies = [
2456
 
2457
  [[package]]
2458
  name = "whisper-rs"
2459
- version = "0.9.0-rc.2"
2460
  source = "registry+https://github.com/rust-lang/crates.io-index"
2461
- checksum = "fa2ccc5c685f7f5050478d253e6c67f0b79baeb0cd0a069aa286275069b958d0"
2462
  dependencies = [
2463
  "whisper-rs-sys",
2464
  ]
2465
 
2466
  [[package]]
2467
  name = "whisper-rs-sys"
2468
- version = "0.7.2"
2469
  source = "registry+https://github.com/rust-lang/crates.io-index"
2470
- checksum = "5c69a0d37a415512fb94332cff2be611d26f65473959b5debbd959997149640e"
2471
  dependencies = [
2472
  "bindgen",
2473
  "cfg-if",
 
2456
 
2457
  [[package]]
2458
  name = "whisper-rs"
2459
+ version = "0.8.0"
2460
  source = "registry+https://github.com/rust-lang/crates.io-index"
2461
+ checksum = "2c950fb18ad556b053ba615b88fd4d01ed6020be740c3371eb0fc4aec64a0639"
2462
  dependencies = [
2463
  "whisper-rs-sys",
2464
  ]
2465
 
2466
  [[package]]
2467
  name = "whisper-rs-sys"
2468
+ version = "0.6.1"
2469
  source = "registry+https://github.com/rust-lang/crates.io-index"
2470
+ checksum = "094a5bd86f6f52562bbc74c28f27cd80197e54656cfb7213cf4ba37b5246cc9e"
2471
  dependencies = [
2472
  "bindgen",
2473
  "cfg-if",
Cargo.toml CHANGED
@@ -20,13 +20,24 @@ tokio = { version = "1.33", features = ["macros", "rt-multi-thread", "sync"] }
20
  tokio-stream = "0.1"
21
  tracing = "0.1"
22
  tracing-subscriber = { version = "0.3", features = ["env-filter"] }
23
- whisper-rs = "0.9.0-rc.2"
24
- whisper-rs-sys = "0.7"
25
 
26
  [dependencies.poem]
27
  version = "1.3"
28
  features = ["websocket", "static-files"]
29
 
30
  [target.aarch64-apple-darwin.dependencies.whisper-rs]
31
- version = "0.9.0-rc.2"
32
- features = ["coreml"]
 
 
 
 
 
 
 
 
 
 
 
 
20
  tokio-stream = "0.1"
21
  tracing = "0.1"
22
  tracing-subscriber = { version = "0.3", features = ["env-filter"] }
23
+ whisper-rs = "0.8"
24
+ whisper-rs-sys = "0.6"
25
 
26
  [dependencies.poem]
27
  version = "1.3"
28
  features = ["websocket", "static-files"]
29
 
30
  [target.aarch64-apple-darwin.dependencies.whisper-rs]
31
+ version = "0.8"
32
+ features = ["coreml"]
33
+
34
+ [target.aarch64-apple-darwin.dependencies.whisper-rs-sys]
35
+ version = "0.6"
36
+
37
+ [target.x86_64-unknown-linux-gnu.dependencies.whisper-rs]
38
+ version = "0.8"
39
+ features = ["cuda"]
40
+
41
+ [target.aarch64-unknown-linux-gnu.dependencies.whisper-rs]
42
+ version = "0.8"
43
+ 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
@@ -38,10 +38,8 @@ pub(crate) struct WhisperParams {
38
  pub(crate) language: Option<String>,
39
  }
40
 
41
- const _NONE: [c_int; 0] = [];
42
-
43
  impl WhisperParams {
44
- pub(crate) fn to_full_params<'a, 'b>(&'a self, _tokens: &'b [c_int]) -> FullParams<'a, 'b> {
45
  let mut param = FullParams::new(Default::default());
46
  param.set_print_progress(self.print_progress);
47
  param.set_print_special(self.print_special);
@@ -60,6 +58,7 @@ impl WhisperParams {
60
  param.set_speed_up(self.speed_up);
61
  // param.set_tdrz_enable(self.tinydiarize);
62
  param.set_temperature_inc(self.temperature_inc);
 
63
 
64
  param
65
  }
 
38
  pub(crate) language: Option<String>,
39
  }
40
 
 
 
41
  impl WhisperParams {
42
+ pub(crate) fn to_full_params<'a, 'b>(&'a self, tokens: &'b [c_int]) -> FullParams<'a, 'b> {
43
  let mut param = FullParams::new(Default::default());
44
  param.set_print_progress(self.print_progress);
45
  param.set_print_special(self.print_special);
 
58
  param.set_speed_up(self.speed_up);
59
  // param.set_tdrz_enable(self.tinydiarize);
60
  param.set_temperature_inc(self.temperature_inc);
61
+ param.set_tokens(tokens);
62
 
63
  param
64
  }
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>