Merge branch 'master' into fix/msys2-build
This commit is contained in:
commit
a04d16166a
8 changed files with 201 additions and 202 deletions
|
|
@ -4,7 +4,7 @@ exclude = ["examples/full_usage"]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "whisper-rs"
|
name = "whisper-rs"
|
||||||
version = "0.10.0"
|
version = "0.10.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Rust bindings for whisper.cpp"
|
description = "Rust bindings for whisper.cpp"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#![allow(clippy::uninlined_format_args)]
|
#![allow(clippy::uninlined_format_args)]
|
||||||
#![cfg_attr(feature = "simd", feature(portable_simd))]
|
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
mod standalone;
|
mod standalone;
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,23 @@ pub fn get_lang_str(id: i32) -> Option<&'static str> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the full string of the specified language name (e.g. 2 -> "german").
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// The full string of the language, None if not found.
|
||||||
|
///
|
||||||
|
/// # C++ equivalent
|
||||||
|
/// `const char * whisper_lang_str_full(int id)`
|
||||||
|
pub fn get_lang_str_full(id: i32) -> Option<&'static str> {
|
||||||
|
let c_buf = unsafe { whisper_rs_sys::whisper_lang_str_full(id) };
|
||||||
|
if c_buf.is_null() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
let c_str = unsafe { CStr::from_ptr(c_buf) };
|
||||||
|
Some(c_str.to_str().unwrap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Callback to control logging output: default behaviour is to print to stderr.
|
/// Callback to control logging output: default behaviour is to print to stderr.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
|
|
|
||||||
101
src/utilities.rs
101
src/utilities.rs
|
|
@ -1,6 +1,3 @@
|
||||||
#[cfg(feature = "simd")]
|
|
||||||
use std::simd::{f32x16, i16x16, SimdInt};
|
|
||||||
|
|
||||||
/// Convert an array of 16 bit mono audio samples to a vector of 32 bit floats.
|
/// Convert an array of 16 bit mono audio samples to a vector of 32 bit floats.
|
||||||
///
|
///
|
||||||
/// This variant does not use SIMD instructions.
|
/// This variant does not use SIMD instructions.
|
||||||
|
|
@ -18,40 +15,6 @@ pub fn convert_integer_to_float_audio(samples: &[i16]) -> Vec<f32> {
|
||||||
floats
|
floats
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert an array of 16 bit mono audio samples to a vector of 32 bit floats.
|
|
||||||
///
|
|
||||||
/// This variant uses SIMD instructions, and as such is only available on
|
|
||||||
/// nightly Rust.
|
|
||||||
///
|
|
||||||
/// # Arguments
|
|
||||||
/// * `samples` - The array of 16 bit mono audio samples.
|
|
||||||
///
|
|
||||||
/// # Returns
|
|
||||||
/// A vector of 32 bit floats.
|
|
||||||
#[cfg(feature = "simd")]
|
|
||||||
pub fn convert_integer_to_float_audio_simd(samples: &[i16]) -> Vec<f32> {
|
|
||||||
let mut floats = Vec::with_capacity(samples.len());
|
|
||||||
|
|
||||||
let div_arr = f32x16::splat(32768.0);
|
|
||||||
|
|
||||||
let chunks = samples.chunks_exact(16);
|
|
||||||
let remainder = chunks.remainder();
|
|
||||||
for chunk in chunks {
|
|
||||||
let simd = i16x16::from_slice(chunk).cast::<f32>();
|
|
||||||
let simd = simd / div_arr;
|
|
||||||
floats.extend(&simd.to_array()[..]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the remainder.
|
|
||||||
// do this normally because it's only a few samples and the overhead of
|
|
||||||
// converting to SIMD is not worth it.
|
|
||||||
for sample in remainder {
|
|
||||||
floats.push(*sample as f32 / 32768.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
floats
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Convert 32 bit floating point stereo PCM audio to 32 bit floating point mono PCM audio.
|
/// Convert 32 bit floating point stereo PCM audio to 32 bit floating point mono PCM audio.
|
||||||
///
|
///
|
||||||
/// This variant does not use SIMD instructions.
|
/// This variant does not use SIMD instructions.
|
||||||
|
|
@ -73,46 +36,6 @@ pub fn convert_stereo_to_mono_audio(samples: &[f32]) -> Result<Vec<f32>, &'stati
|
||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert 32 bit floating point stereo PCM audio to 32 bit floating point mono PCM audio.
|
|
||||||
///
|
|
||||||
/// This variant uses SIMD instructions, and as such is only available on
|
|
||||||
/// nightly Rust.
|
|
||||||
///
|
|
||||||
/// # Arguments
|
|
||||||
/// * `samples` - The array of 32 bit floating point stereo PCM audio samples.
|
|
||||||
///
|
|
||||||
/// # Returns
|
|
||||||
/// A vector of 32 bit floating point mono PCM audio samples.
|
|
||||||
#[cfg(feature = "simd")]
|
|
||||||
pub fn convert_stereo_to_mono_audio_simd(samples: &[f32]) -> Result<Vec<f32>, &'static str> {
|
|
||||||
let mut mono = Vec::with_capacity(samples.len() / 2);
|
|
||||||
|
|
||||||
let div_array = f32x16::splat(2.0);
|
|
||||||
|
|
||||||
let chunks = samples.chunks_exact(32);
|
|
||||||
let remainder = chunks.remainder();
|
|
||||||
for chunk in chunks {
|
|
||||||
let [c1, c2] = [0, 1].map(|offset| {
|
|
||||||
let mut arr = [0.0; 16];
|
|
||||||
std::iter::zip(&mut arr, chunk.iter().skip(offset).step_by(2).copied())
|
|
||||||
.for_each(|(a, c)| *a = c);
|
|
||||||
arr
|
|
||||||
});
|
|
||||||
|
|
||||||
let c1 = f32x16::from(c1);
|
|
||||||
let c2 = f32x16::from(c2);
|
|
||||||
let mono_simd = (c1 + c2) / div_array;
|
|
||||||
mono.extend(&mono_simd.to_array()[..]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the remainder.
|
|
||||||
// do this normally because it's only a few samples and the overhead of
|
|
||||||
// converting to SIMD is not worth it.
|
|
||||||
mono.extend(convert_stereo_to_mono_audio(remainder)?);
|
|
||||||
|
|
||||||
Ok(mono)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "simd")]
|
#[cfg(feature = "simd")]
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
@ -126,27 +49,3 @@ mod test {
|
||||||
assert!(mono.is_err());
|
assert!(mono.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "simd")]
|
|
||||||
#[cfg(test)]
|
|
||||||
mod test_simd {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
pub fn assert_stereo_to_mono_simd() {
|
|
||||||
// fake some sample data
|
|
||||||
let samples = (0u16..1028).map(f32::from).collect::<Vec<f32>>();
|
|
||||||
let mono_simd = convert_stereo_to_mono_audio_simd(&samples);
|
|
||||||
let mono = convert_stereo_to_mono_audio(&samples);
|
|
||||||
assert_eq!(mono_simd, mono);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
pub fn assert_stereo_to_mono_simd_err() {
|
|
||||||
// fake some sample data
|
|
||||||
let samples = (0u16..1029).map(f32::from).collect::<Vec<f32>>();
|
|
||||||
let mono_simd = convert_stereo_to_mono_audio_simd(&samples);
|
|
||||||
let mono = convert_stereo_to_mono_audio(&samples);
|
|
||||||
assert_eq!(mono_simd, mono);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -593,6 +593,7 @@ impl<'a, 'b> FullParams<'a, 'b> {
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # use whisper_rs::{FullParams, SamplingStrategy};
|
||||||
/// let mut params = FullParams::new(SamplingStrategy::default());
|
/// let mut params = FullParams::new(SamplingStrategy::default());
|
||||||
/// params.set_initial_prompt("Hello, world!");
|
/// params.set_initial_prompt("Hello, world!");
|
||||||
/// // ... further usage of params ...
|
/// // ... further usage of params ...
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "whisper-rs-sys"
|
name = "whisper-rs-sys"
|
||||||
version = "0.8.0"
|
version = "0.8.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Rust bindings for whisper.cpp (FFI bindings)"
|
description = "Rust bindings for whisper.cpp (FFI bindings)"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,9 @@ pub const GGML_FILE_VERSION: u32 = 1;
|
||||||
pub const GGML_QNT_VERSION: u32 = 2;
|
pub const GGML_QNT_VERSION: u32 = 2;
|
||||||
pub const GGML_QNT_VERSION_FACTOR: u32 = 1000;
|
pub const GGML_QNT_VERSION_FACTOR: u32 = 1000;
|
||||||
pub const GGML_MAX_DIMS: u32 = 4;
|
pub const GGML_MAX_DIMS: u32 = 4;
|
||||||
pub const GGML_MAX_PARAMS: u32 = 1024;
|
pub const GGML_MAX_PARAMS: u32 = 2048;
|
||||||
pub const GGML_MAX_CONTEXTS: u32 = 64;
|
pub const GGML_MAX_CONTEXTS: u32 = 64;
|
||||||
pub const GGML_MAX_SRC: u32 = 6;
|
pub const GGML_MAX_SRC: u32 = 10;
|
||||||
pub const GGML_MAX_NAME: u32 = 64;
|
pub const GGML_MAX_NAME: u32 = 64;
|
||||||
pub const GGML_MAX_OP_PARAMS: u32 = 64;
|
pub const GGML_MAX_OP_PARAMS: u32 = 64;
|
||||||
pub const GGML_DEFAULT_N_THREADS: u32 = 4;
|
pub const GGML_DEFAULT_N_THREADS: u32 = 4;
|
||||||
|
|
@ -313,6 +313,9 @@ pub const ggml_type_GGML_TYPE_I16: ggml_type = 17;
|
||||||
pub const ggml_type_GGML_TYPE_I32: ggml_type = 18;
|
pub const ggml_type_GGML_TYPE_I32: ggml_type = 18;
|
||||||
pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 19;
|
pub const ggml_type_GGML_TYPE_COUNT: ggml_type = 19;
|
||||||
pub type ggml_type = ::std::os::raw::c_uint;
|
pub type ggml_type = ::std::os::raw::c_uint;
|
||||||
|
pub const ggml_prec_GGML_PREC_DEFAULT: ggml_prec = 0;
|
||||||
|
pub const ggml_prec_GGML_PREC_F32: ggml_prec = 1;
|
||||||
|
pub type ggml_prec = ::std::os::raw::c_uint;
|
||||||
pub const ggml_backend_type_GGML_BACKEND_CPU: ggml_backend_type = 0;
|
pub const ggml_backend_type_GGML_BACKEND_CPU: ggml_backend_type = 0;
|
||||||
pub const ggml_backend_type_GGML_BACKEND_GPU: ggml_backend_type = 10;
|
pub const ggml_backend_type_GGML_BACKEND_GPU: ggml_backend_type = 10;
|
||||||
pub const ggml_backend_type_GGML_BACKEND_GPU_SPLIT: ggml_backend_type = 20;
|
pub const ggml_backend_type_GGML_BACKEND_GPU_SPLIT: ggml_backend_type = 20;
|
||||||
|
|
@ -356,51 +359,55 @@ pub const ggml_op_GGML_OP_RMS_NORM: ggml_op = 20;
|
||||||
pub const ggml_op_GGML_OP_RMS_NORM_BACK: ggml_op = 21;
|
pub const ggml_op_GGML_OP_RMS_NORM_BACK: ggml_op = 21;
|
||||||
pub const ggml_op_GGML_OP_GROUP_NORM: ggml_op = 22;
|
pub const ggml_op_GGML_OP_GROUP_NORM: ggml_op = 22;
|
||||||
pub const ggml_op_GGML_OP_MUL_MAT: ggml_op = 23;
|
pub const ggml_op_GGML_OP_MUL_MAT: ggml_op = 23;
|
||||||
pub const ggml_op_GGML_OP_OUT_PROD: ggml_op = 24;
|
pub const ggml_op_GGML_OP_MUL_MAT_ID: ggml_op = 24;
|
||||||
pub const ggml_op_GGML_OP_SCALE: ggml_op = 25;
|
pub const ggml_op_GGML_OP_OUT_PROD: ggml_op = 25;
|
||||||
pub const ggml_op_GGML_OP_SET: ggml_op = 26;
|
pub const ggml_op_GGML_OP_SCALE: ggml_op = 26;
|
||||||
pub const ggml_op_GGML_OP_CPY: ggml_op = 27;
|
pub const ggml_op_GGML_OP_SET: ggml_op = 27;
|
||||||
pub const ggml_op_GGML_OP_CONT: ggml_op = 28;
|
pub const ggml_op_GGML_OP_CPY: ggml_op = 28;
|
||||||
pub const ggml_op_GGML_OP_RESHAPE: ggml_op = 29;
|
pub const ggml_op_GGML_OP_CONT: ggml_op = 29;
|
||||||
pub const ggml_op_GGML_OP_VIEW: ggml_op = 30;
|
pub const ggml_op_GGML_OP_RESHAPE: ggml_op = 30;
|
||||||
pub const ggml_op_GGML_OP_PERMUTE: ggml_op = 31;
|
pub const ggml_op_GGML_OP_VIEW: ggml_op = 31;
|
||||||
pub const ggml_op_GGML_OP_TRANSPOSE: ggml_op = 32;
|
pub const ggml_op_GGML_OP_PERMUTE: ggml_op = 32;
|
||||||
pub const ggml_op_GGML_OP_GET_ROWS: ggml_op = 33;
|
pub const ggml_op_GGML_OP_TRANSPOSE: ggml_op = 33;
|
||||||
pub const ggml_op_GGML_OP_GET_ROWS_BACK: ggml_op = 34;
|
pub const ggml_op_GGML_OP_GET_ROWS: ggml_op = 34;
|
||||||
pub const ggml_op_GGML_OP_DIAG: ggml_op = 35;
|
pub const ggml_op_GGML_OP_GET_ROWS_BACK: ggml_op = 35;
|
||||||
pub const ggml_op_GGML_OP_DIAG_MASK_INF: ggml_op = 36;
|
pub const ggml_op_GGML_OP_DIAG: ggml_op = 36;
|
||||||
pub const ggml_op_GGML_OP_DIAG_MASK_ZERO: ggml_op = 37;
|
pub const ggml_op_GGML_OP_DIAG_MASK_INF: ggml_op = 37;
|
||||||
pub const ggml_op_GGML_OP_SOFT_MAX: ggml_op = 38;
|
pub const ggml_op_GGML_OP_DIAG_MASK_ZERO: ggml_op = 38;
|
||||||
pub const ggml_op_GGML_OP_SOFT_MAX_BACK: ggml_op = 39;
|
pub const ggml_op_GGML_OP_SOFT_MAX: ggml_op = 39;
|
||||||
pub const ggml_op_GGML_OP_ROPE: ggml_op = 40;
|
pub const ggml_op_GGML_OP_SOFT_MAX_BACK: ggml_op = 40;
|
||||||
pub const ggml_op_GGML_OP_ROPE_BACK: ggml_op = 41;
|
pub const ggml_op_GGML_OP_ROPE: ggml_op = 41;
|
||||||
pub const ggml_op_GGML_OP_ALIBI: ggml_op = 42;
|
pub const ggml_op_GGML_OP_ROPE_BACK: ggml_op = 42;
|
||||||
pub const ggml_op_GGML_OP_CLAMP: ggml_op = 43;
|
pub const ggml_op_GGML_OP_ALIBI: ggml_op = 43;
|
||||||
pub const ggml_op_GGML_OP_CONV_TRANSPOSE_1D: ggml_op = 44;
|
pub const ggml_op_GGML_OP_CLAMP: ggml_op = 44;
|
||||||
pub const ggml_op_GGML_OP_IM2COL: ggml_op = 45;
|
pub const ggml_op_GGML_OP_CONV_TRANSPOSE_1D: ggml_op = 45;
|
||||||
pub const ggml_op_GGML_OP_CONV_TRANSPOSE_2D: ggml_op = 46;
|
pub const ggml_op_GGML_OP_IM2COL: ggml_op = 46;
|
||||||
pub const ggml_op_GGML_OP_POOL_1D: ggml_op = 47;
|
pub const ggml_op_GGML_OP_CONV_TRANSPOSE_2D: ggml_op = 47;
|
||||||
pub const ggml_op_GGML_OP_POOL_2D: ggml_op = 48;
|
pub const ggml_op_GGML_OP_POOL_1D: ggml_op = 48;
|
||||||
pub const ggml_op_GGML_OP_UPSCALE: ggml_op = 49;
|
pub const ggml_op_GGML_OP_POOL_2D: ggml_op = 49;
|
||||||
pub const ggml_op_GGML_OP_FLASH_ATTN: ggml_op = 50;
|
pub const ggml_op_GGML_OP_UPSCALE: ggml_op = 50;
|
||||||
pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 51;
|
pub const ggml_op_GGML_OP_PAD: ggml_op = 51;
|
||||||
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 52;
|
pub const ggml_op_GGML_OP_ARGSORT: ggml_op = 52;
|
||||||
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 53;
|
pub const ggml_op_GGML_OP_LEAKY_RELU: ggml_op = 53;
|
||||||
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 54;
|
pub const ggml_op_GGML_OP_FLASH_ATTN: ggml_op = 54;
|
||||||
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 55;
|
pub const ggml_op_GGML_OP_FLASH_FF: ggml_op = 55;
|
||||||
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 56;
|
pub const ggml_op_GGML_OP_FLASH_ATTN_BACK: ggml_op = 56;
|
||||||
pub const ggml_op_GGML_OP_UNARY: ggml_op = 57;
|
pub const ggml_op_GGML_OP_WIN_PART: ggml_op = 57;
|
||||||
pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 58;
|
pub const ggml_op_GGML_OP_WIN_UNPART: ggml_op = 58;
|
||||||
pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 59;
|
pub const ggml_op_GGML_OP_GET_REL_POS: ggml_op = 59;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 60;
|
pub const ggml_op_GGML_OP_ADD_REL_POS: ggml_op = 60;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 61;
|
pub const ggml_op_GGML_OP_UNARY: ggml_op = 61;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 62;
|
pub const ggml_op_GGML_OP_MAP_UNARY: ggml_op = 62;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 63;
|
pub const ggml_op_GGML_OP_MAP_BINARY: ggml_op = 63;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 64;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM1_F32: ggml_op = 64;
|
||||||
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 65;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM2_F32: ggml_op = 65;
|
||||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 66;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM3_F32: ggml_op = 66;
|
||||||
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 67;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM1: ggml_op = 67;
|
||||||
pub const ggml_op_GGML_OP_COUNT: ggml_op = 68;
|
pub const ggml_op_GGML_OP_MAP_CUSTOM2: ggml_op = 68;
|
||||||
|
pub const ggml_op_GGML_OP_MAP_CUSTOM3: ggml_op = 69;
|
||||||
|
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS: ggml_op = 70;
|
||||||
|
pub const ggml_op_GGML_OP_CROSS_ENTROPY_LOSS_BACK: ggml_op = 71;
|
||||||
|
pub const ggml_op_GGML_OP_COUNT: ggml_op = 72;
|
||||||
pub type ggml_op = ::std::os::raw::c_uint;
|
pub type ggml_op = ::std::os::raw::c_uint;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_ABS: ggml_unary_op = 0;
|
pub const ggml_unary_op_GGML_UNARY_OP_ABS: ggml_unary_op = 0;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_SGN: ggml_unary_op = 1;
|
pub const ggml_unary_op_GGML_UNARY_OP_SGN: ggml_unary_op = 1;
|
||||||
|
|
@ -412,7 +419,7 @@ pub const ggml_unary_op_GGML_UNARY_OP_RELU: ggml_unary_op = 6;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_GELU: ggml_unary_op = 7;
|
pub const ggml_unary_op_GGML_UNARY_OP_GELU: ggml_unary_op = 7;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_GELU_QUICK: ggml_unary_op = 8;
|
pub const ggml_unary_op_GGML_UNARY_OP_GELU_QUICK: ggml_unary_op = 8;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_SILU: ggml_unary_op = 9;
|
pub const ggml_unary_op_GGML_UNARY_OP_SILU: ggml_unary_op = 9;
|
||||||
pub const ggml_unary_op_GGML_UNARY_OP_LEAKY: ggml_unary_op = 10;
|
pub const ggml_unary_op_GGML_UNARY_OP_COUNT: ggml_unary_op = 10;
|
||||||
pub type ggml_unary_op = ::std::os::raw::c_uint;
|
pub type ggml_unary_op = ::std::os::raw::c_uint;
|
||||||
pub const ggml_object_type_GGML_OBJECT_TENSOR: ggml_object_type = 0;
|
pub const ggml_object_type_GGML_OBJECT_TENSOR: ggml_object_type = 0;
|
||||||
pub const ggml_object_type_GGML_OBJECT_GRAPH: ggml_object_type = 1;
|
pub const ggml_object_type_GGML_OBJECT_GRAPH: ggml_object_type = 1;
|
||||||
|
|
@ -421,6 +428,7 @@ pub type ggml_object_type = ::std::os::raw::c_uint;
|
||||||
pub const ggml_log_level_GGML_LOG_LEVEL_ERROR: ggml_log_level = 2;
|
pub const ggml_log_level_GGML_LOG_LEVEL_ERROR: ggml_log_level = 2;
|
||||||
pub const ggml_log_level_GGML_LOG_LEVEL_WARN: ggml_log_level = 3;
|
pub const ggml_log_level_GGML_LOG_LEVEL_WARN: ggml_log_level = 3;
|
||||||
pub const ggml_log_level_GGML_LOG_LEVEL_INFO: ggml_log_level = 4;
|
pub const ggml_log_level_GGML_LOG_LEVEL_INFO: ggml_log_level = 4;
|
||||||
|
pub const ggml_log_level_GGML_LOG_LEVEL_DEBUG: ggml_log_level = 5;
|
||||||
pub type ggml_log_level = ::std::os::raw::c_uint;
|
pub type ggml_log_level = ::std::os::raw::c_uint;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
@ -503,14 +511,13 @@ pub struct ggml_tensor {
|
||||||
pub type_: ggml_type,
|
pub type_: ggml_type,
|
||||||
pub backend: ggml_backend_type,
|
pub backend: ggml_backend_type,
|
||||||
pub buffer: *mut ggml_backend_buffer,
|
pub buffer: *mut ggml_backend_buffer,
|
||||||
pub n_dims: ::std::os::raw::c_int,
|
|
||||||
pub ne: [i64; 4usize],
|
pub ne: [i64; 4usize],
|
||||||
pub nb: [usize; 4usize],
|
pub nb: [usize; 4usize],
|
||||||
pub op: ggml_op,
|
pub op: ggml_op,
|
||||||
pub op_params: [i32; 16usize],
|
pub op_params: [i32; 16usize],
|
||||||
pub is_param: bool,
|
pub is_param: bool,
|
||||||
pub grad: *mut ggml_tensor,
|
pub grad: *mut ggml_tensor,
|
||||||
pub src: [*mut ggml_tensor; 6usize],
|
pub src: [*mut ggml_tensor; 10usize],
|
||||||
pub perf_runs: ::std::os::raw::c_int,
|
pub perf_runs: ::std::os::raw::c_int,
|
||||||
pub perf_cycles: i64,
|
pub perf_cycles: i64,
|
||||||
pub perf_time_us: i64,
|
pub perf_time_us: i64,
|
||||||
|
|
@ -519,7 +526,7 @@ pub struct ggml_tensor {
|
||||||
pub data: *mut ::std::os::raw::c_void,
|
pub data: *mut ::std::os::raw::c_void,
|
||||||
pub name: [::std::os::raw::c_char; 64usize],
|
pub name: [::std::os::raw::c_char; 64usize],
|
||||||
pub extra: *mut ::std::os::raw::c_void,
|
pub extra: *mut ::std::os::raw::c_void,
|
||||||
pub padding: [::std::os::raw::c_char; 12usize],
|
pub padding: [::std::os::raw::c_char; 8usize],
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn bindgen_test_layout_ggml_tensor() {
|
fn bindgen_test_layout_ggml_tensor() {
|
||||||
|
|
@ -527,7 +534,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
let ptr = UNINIT.as_ptr();
|
let ptr = UNINIT.as_ptr();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
::std::mem::size_of::<ggml_tensor>(),
|
::std::mem::size_of::<ggml_tensor>(),
|
||||||
352usize,
|
368usize,
|
||||||
concat!("Size of: ", stringify!(ggml_tensor))
|
concat!("Size of: ", stringify!(ggml_tensor))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -565,19 +572,9 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
stringify!(buffer)
|
stringify!(buffer)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).n_dims) as usize - ptr as usize },
|
|
||||||
16usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(ggml_tensor),
|
|
||||||
"::",
|
|
||||||
stringify!(n_dims)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).ne) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).ne) as usize - ptr as usize },
|
||||||
24usize,
|
16usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -587,7 +584,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).nb) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).nb) as usize - ptr as usize },
|
||||||
56usize,
|
48usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -597,7 +594,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).op) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).op) as usize - ptr as usize },
|
||||||
88usize,
|
80usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -607,7 +604,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).op_params) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).op_params) as usize - ptr as usize },
|
||||||
92usize,
|
84usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -617,7 +614,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).is_param) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).is_param) as usize - ptr as usize },
|
||||||
156usize,
|
148usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -627,7 +624,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).grad) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).grad) as usize - ptr as usize },
|
||||||
160usize,
|
152usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -637,7 +634,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize },
|
||||||
168usize,
|
160usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -647,7 +644,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_runs) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).perf_runs) as usize - ptr as usize },
|
||||||
216usize,
|
240usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -657,7 +654,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_cycles) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).perf_cycles) as usize - ptr as usize },
|
||||||
224usize,
|
248usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -667,7 +664,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).perf_time_us) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).perf_time_us) as usize - ptr as usize },
|
||||||
232usize,
|
256usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -677,7 +674,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).view_src) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).view_src) as usize - ptr as usize },
|
||||||
240usize,
|
264usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -687,7 +684,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).view_offs) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).view_offs) as usize - ptr as usize },
|
||||||
248usize,
|
272usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -697,7 +694,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
|
||||||
256usize,
|
280usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -707,7 +704,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
|
||||||
264usize,
|
288usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -717,7 +714,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize },
|
||||||
328usize,
|
352usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -727,7 +724,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize },
|
unsafe { ::std::ptr::addr_of!((*ptr).padding) as usize - ptr as usize },
|
||||||
336usize,
|
360usize,
|
||||||
concat!(
|
concat!(
|
||||||
"Offset of field: ",
|
"Offset of field: ",
|
||||||
stringify!(ggml_tensor),
|
stringify!(ggml_tensor),
|
||||||
|
|
@ -736,7 +733,7 @@ fn bindgen_test_layout_ggml_tensor() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pub const GGML_TENSOR_SIZE: usize = 352;
|
pub const GGML_TENSOR_SIZE: usize = 368;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct ggml_cplan {
|
pub struct ggml_cplan {
|
||||||
|
|
@ -1221,12 +1218,6 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize;
|
pub fn ggml_nbytes_pad(tensor: *const ggml_tensor) -> usize;
|
||||||
}
|
}
|
||||||
extern "C" {
|
|
||||||
pub fn ggml_nbytes_split(
|
|
||||||
tensor: *const ggml_tensor,
|
|
||||||
nrows_split: ::std::os::raw::c_int,
|
|
||||||
) -> usize;
|
|
||||||
}
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_blck_size(type_: ggml_type) -> ::std::os::raw::c_int;
|
pub fn ggml_blck_size(type_: ggml_type) -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
|
|
@ -1234,7 +1225,10 @@ extern "C" {
|
||||||
pub fn ggml_type_size(type_: ggml_type) -> usize;
|
pub fn ggml_type_size(type_: ggml_type) -> usize;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_type_sizef(type_: ggml_type) -> f32;
|
pub fn ggml_row_size(type_: ggml_type, ne: i64) -> usize;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_type_sizef(type_: ggml_type) -> f64;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_type_name(type_: ggml_type) -> *const ::std::os::raw::c_char;
|
pub fn ggml_type_name(type_: ggml_type) -> *const ::std::os::raw::c_char;
|
||||||
|
|
@ -1245,6 +1239,12 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_op_symbol(op: ggml_op) -> *const ::std::os::raw::c_char;
|
pub fn ggml_op_symbol(op: ggml_op) -> *const ::std::os::raw::c_char;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_unary_op_name(op: ggml_unary_op) -> *const ::std::os::raw::c_char;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_op_desc(t: *const ggml_tensor) -> *const ::std::os::raw::c_char;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_element_size(tensor: *const ggml_tensor) -> usize;
|
pub fn ggml_element_size(tensor: *const ggml_tensor) -> usize;
|
||||||
}
|
}
|
||||||
|
|
@ -1263,6 +1263,21 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool;
|
pub fn ggml_is_permuted(tensor: *const ggml_tensor) -> bool;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_is_scalar(tensor: *const ggml_tensor) -> bool;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_is_vector(tensor: *const ggml_tensor) -> bool;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_is_matrix(tensor: *const ggml_tensor) -> bool;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_is_3d(tensor: *const ggml_tensor) -> bool;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_n_dims(tensor: *const ggml_tensor) -> ::std::os::raw::c_int;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
pub fn ggml_are_same_shape(t0: *const ggml_tensor, t1: *const ggml_tensor) -> bool;
|
||||||
}
|
}
|
||||||
|
|
@ -1351,11 +1366,11 @@ extern "C" {
|
||||||
pub fn ggml_view_tensor(ctx: *mut ggml_context, src: *mut ggml_tensor) -> *mut ggml_tensor;
|
pub fn ggml_view_tensor(ctx: *mut ggml_context, src: *mut ggml_tensor) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_get_first_tensor(ctx: *mut ggml_context) -> *mut ggml_tensor;
|
pub fn ggml_get_first_tensor(ctx: *const ggml_context) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_get_next_tensor(
|
pub fn ggml_get_next_tensor(
|
||||||
ctx: *mut ggml_context,
|
ctx: *const ggml_context,
|
||||||
tensor: *mut ggml_tensor,
|
tensor: *mut ggml_tensor,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
|
|
@ -1656,7 +1671,12 @@ extern "C" {
|
||||||
pub fn ggml_relu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
pub fn ggml_relu(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_leaky(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
pub fn ggml_leaky_relu(
|
||||||
|
ctx: *mut ggml_context,
|
||||||
|
a: *mut ggml_tensor,
|
||||||
|
negative_slope: f32,
|
||||||
|
inplace: bool,
|
||||||
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_relu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
pub fn ggml_relu_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
||||||
|
|
@ -1737,6 +1757,19 @@ extern "C" {
|
||||||
b: *mut ggml_tensor,
|
b: *mut ggml_tensor,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_mul_mat_set_prec(a: *mut ggml_tensor, prec: ggml_prec);
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_mul_mat_id(
|
||||||
|
ctx: *mut ggml_context,
|
||||||
|
as_: *const *mut ggml_tensor,
|
||||||
|
n_as: ::std::os::raw::c_int,
|
||||||
|
ids: *mut ggml_tensor,
|
||||||
|
id: ::std::os::raw::c_int,
|
||||||
|
b: *mut ggml_tensor,
|
||||||
|
) -> *mut ggml_tensor;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_out_prod(
|
pub fn ggml_out_prod(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
|
|
@ -1745,17 +1778,13 @@ extern "C" {
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_scale(
|
pub fn ggml_scale(ctx: *mut ggml_context, a: *mut ggml_tensor, s: f32) -> *mut ggml_tensor;
|
||||||
ctx: *mut ggml_context,
|
|
||||||
a: *mut ggml_tensor,
|
|
||||||
b: *mut ggml_tensor,
|
|
||||||
) -> *mut ggml_tensor;
|
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_scale_inplace(
|
pub fn ggml_scale_inplace(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
a: *mut ggml_tensor,
|
a: *mut ggml_tensor,
|
||||||
b: *mut ggml_tensor,
|
s: f32,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -2014,6 +2043,14 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_soft_max_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
pub fn ggml_soft_max_inplace(ctx: *mut ggml_context, a: *mut ggml_tensor) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_soft_max_ext(
|
||||||
|
ctx: *mut ggml_context,
|
||||||
|
a: *mut ggml_tensor,
|
||||||
|
mask: *mut ggml_tensor,
|
||||||
|
scale: f32,
|
||||||
|
) -> *mut ggml_tensor;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_soft_max_back(
|
pub fn ggml_soft_max_back(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
|
|
@ -2110,8 +2147,13 @@ extern "C" {
|
||||||
n_dims: ::std::os::raw::c_int,
|
n_dims: ::std::os::raw::c_int,
|
||||||
mode: ::std::os::raw::c_int,
|
mode: ::std::os::raw::c_int,
|
||||||
n_ctx: ::std::os::raw::c_int,
|
n_ctx: ::std::os::raw::c_int,
|
||||||
|
n_orig_ctx: ::std::os::raw::c_int,
|
||||||
freq_base: f32,
|
freq_base: f32,
|
||||||
freq_scale: f32,
|
freq_scale: f32,
|
||||||
|
ext_factor: f32,
|
||||||
|
attn_factor: f32,
|
||||||
|
beta_fast: f32,
|
||||||
|
beta_slow: f32,
|
||||||
xpos_base: f32,
|
xpos_base: f32,
|
||||||
xpos_down: bool,
|
xpos_down: bool,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
|
|
@ -2245,6 +2287,33 @@ extern "C" {
|
||||||
scale_factor: ::std::os::raw::c_int,
|
scale_factor: ::std::os::raw::c_int,
|
||||||
) -> *mut ggml_tensor;
|
) -> *mut ggml_tensor;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_pad(
|
||||||
|
ctx: *mut ggml_context,
|
||||||
|
a: *mut ggml_tensor,
|
||||||
|
p0: ::std::os::raw::c_int,
|
||||||
|
p1: ::std::os::raw::c_int,
|
||||||
|
p2: ::std::os::raw::c_int,
|
||||||
|
p3: ::std::os::raw::c_int,
|
||||||
|
) -> *mut ggml_tensor;
|
||||||
|
}
|
||||||
|
pub const ggml_sort_order_GGML_SORT_ASC: ggml_sort_order = 0;
|
||||||
|
pub const ggml_sort_order_GGML_SORT_DESC: ggml_sort_order = 1;
|
||||||
|
pub type ggml_sort_order = ::std::os::raw::c_uint;
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_argsort(
|
||||||
|
ctx: *mut ggml_context,
|
||||||
|
a: *mut ggml_tensor,
|
||||||
|
order: ggml_sort_order,
|
||||||
|
) -> *mut ggml_tensor;
|
||||||
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_top_k(
|
||||||
|
ctx: *mut ggml_context,
|
||||||
|
a: *mut ggml_tensor,
|
||||||
|
k: ::std::os::raw::c_int,
|
||||||
|
) -> *mut ggml_tensor;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_flash_attn(
|
pub fn ggml_flash_attn(
|
||||||
ctx: *mut ggml_context,
|
ctx: *mut ggml_context,
|
||||||
|
|
@ -2568,11 +2637,10 @@ extern "C" {
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_graph_view(
|
pub fn ggml_graph_view(
|
||||||
ctx: *mut ggml_context,
|
|
||||||
cgraph: *mut ggml_cgraph,
|
cgraph: *mut ggml_cgraph,
|
||||||
i0: ::std::os::raw::c_int,
|
i0: ::std::os::raw::c_int,
|
||||||
i1: ::std::os::raw::c_int,
|
i1: ::std::os::raw::c_int,
|
||||||
) -> *mut ggml_cgraph;
|
) -> ggml_cgraph;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_graph_cpy(src: *mut ggml_cgraph, dst: *mut ggml_cgraph);
|
pub fn ggml_graph_cpy(src: *mut ggml_cgraph, dst: *mut ggml_cgraph);
|
||||||
|
|
@ -3774,6 +3842,12 @@ extern "C" {
|
||||||
key_id: ::std::os::raw::c_int,
|
key_id: ::std::os::raw::c_int,
|
||||||
) -> *const ::std::os::raw::c_char;
|
) -> *const ::std::os::raw::c_char;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn gguf_get_val_data(
|
||||||
|
ctx: *const gguf_context,
|
||||||
|
key_id: ::std::os::raw::c_int,
|
||||||
|
) -> *const ::std::os::raw::c_void;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn gguf_get_arr_n(
|
pub fn gguf_get_arr_n(
|
||||||
ctx: *const gguf_context,
|
ctx: *const gguf_context,
|
||||||
|
|
@ -3811,6 +3885,9 @@ extern "C" {
|
||||||
i: ::std::os::raw::c_int,
|
i: ::std::os::raw::c_int,
|
||||||
) -> *mut ::std::os::raw::c_char;
|
) -> *mut ::std::os::raw::c_char;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn gguf_get_tensor_type(ctx: *const gguf_context, i: ::std::os::raw::c_int) -> ggml_type;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn gguf_set_val_u8(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u8);
|
pub fn gguf_set_val_u8(ctx: *mut gguf_context, key: *const ::std::os::raw::c_char, val: u8);
|
||||||
}
|
}
|
||||||
|
|
@ -3905,6 +3982,9 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_avx() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_avx() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn ggml_cpu_has_avx_vnni() -> ::std::os::raw::c_int;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn ggml_cpu_has_avx2() -> ::std::os::raw::c_int;
|
pub fn ggml_cpu_has_avx2() -> ::std::os::raw::c_int;
|
||||||
}
|
}
|
||||||
|
|
@ -4566,6 +4646,9 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn whisper_lang_str(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
|
pub fn whisper_lang_str(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn whisper_lang_str_full(id: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn whisper_lang_auto_detect(
|
pub fn whisper_lang_auto_detect(
|
||||||
ctx: *mut whisper_context,
|
ctx: *mut whisper_context,
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit d38af151a1ed5378c5a9ae368e767ed22c8ab141
|
Subproject commit 0b9af32a8b3fa7e2ae5f15a9a08f5b10394993f5
|
||||||
Loading…
Add table
Add a link
Reference in a new issue