repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
adrien-bon/bevy_ecs_tiled | https://github.com/adrien-bon/bevy_ecs_tiled/blob/82018c14762a9363f6813b41fd4659266a337e3b/examples/helper/anchor.rs | examples/helper/anchor.rs | use bevy::prelude::*;
use bevy_ecs_tilemap::prelude::TilemapAnchor;
#[allow(dead_code)]
/// Rotate the tilemap anchor to the right generally but also show custom and
/// none for completeness.
pub fn rotate_right(anchor: &TilemapAnchor) -> TilemapAnchor {
use TilemapAnchor::*;
match anchor {
TopLeft =>... | rust | MIT | 82018c14762a9363f6813b41fd4659266a337e3b | 2026-01-04T20:23:27.337930Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/actix/src/main.rs | api/actix/src/main.rs | use actix_cors::Cors;
use actix_web::{web, App, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// init env vars
dotenv::dotenv().ok();
// init tracing subscriber
let tracing = tracing_subscriber::fmt()
.with_timer(tracing_subscriber::fmt::time::UtcTime::rfc_3339())
... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/lib.rs | api/lib/src/lib.rs | pub mod film_repository;
pub mod health;
pub mod v1;
| rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/health.rs | api/lib/src/health.rs | use actix_web::{
web::{self, ServiceConfig},
HttpResponse,
};
pub const API_VERSION: &str = "v0.0.3";
pub fn service(cfg: &mut ServiceConfig) {
cfg.route("/health", web::get().to(health_check));
}
async fn health_check() -> HttpResponse {
HttpResponse::Ok()
.append_header(("health-check", API... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/v1/films.rs | api/lib/src/v1/films.rs | use actix_web::{
web::{self, ServiceConfig},
HttpResponse,
};
use shared::models::{CreateFilm, Film};
use uuid::Uuid;
use crate::film_repository::FilmRepository;
pub fn service<R: FilmRepository>(cfg: &mut ServiceConfig) {
cfg.service(
web::scope("/films")
// GET
.route("",... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/v1/mod.rs | api/lib/src/v1/mod.rs | use actix_web::web::{self, ServiceConfig};
use crate::film_repository::FilmRepository;
mod films;
pub fn service<R: FilmRepository>(cfg: &mut ServiceConfig) {
cfg.service(web::scope("/v1").configure(films::service::<R>));
}
| rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/film_repository/memory_film_repository.rs | api/lib/src/film_repository/memory_film_repository.rs | use std::{collections::HashMap, sync::RwLock};
use async_trait::async_trait;
use chrono::Utc;
use shared::models::{CreateFilm, Film};
use uuid::Uuid;
use super::{FilmRepository, FilmResult};
pub struct MemoryFilmRepository {
films: RwLock<HashMap<Uuid, Film>>,
}
impl MemoryFilmRepository {
pub fn new() -> S... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/film_repository/postgres_film_repository.rs | api/lib/src/film_repository/postgres_film_repository.rs | use async_trait::async_trait;
use shared::models::{CreateFilm, Film};
use uuid::Uuid;
use super::{FilmRepository, FilmResult};
pub struct PostgresFilmRepository {
pool: sqlx::PgPool,
}
impl PostgresFilmRepository {
pub fn new(pool: sqlx::PgPool) -> Self {
Self { pool }
}
}
#[async_trait]
impl Fi... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/src/film_repository/mod.rs | api/lib/src/film_repository/mod.rs | mod memory_film_repository;
mod postgres_film_repository;
pub use memory_film_repository::MemoryFilmRepository;
pub use postgres_film_repository::PostgresFilmRepository;
use async_trait::async_trait;
use shared::models::{CreateFilm, Film};
use uuid::Uuid;
pub type FilmError = String;
pub type FilmResult<T> = Result<... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/tests/health.rs | api/lib/tests/health.rs | mod integration {
use actix_web::{http::StatusCode, App};
use api_lib::health::{service, API_VERSION};
#[actix_rt::test]
async fn health_check_works() {
let app = App::new().configure(service);
let mut app = actix_web::test::init_service(app).await;
let req = actix_web::test::T... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/lib/tests/v1.rs | api/lib/tests/v1.rs | mod integration {
use actix_web::{http::StatusCode, web, App};
use api_lib::film_repository::{FilmRepository, MemoryFilmRepository};
use shared::models::{CreateFilm, Film};
fn create_test_film(id: &'static str) -> Film {
Film {
id: uuid::Uuid::new_v4(),
title: format!("... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/api/shuttle/src/main.rs | api/shuttle/src/main.rs | use actix_files::Files;
use actix_web::web::{self, ServiceConfig};
use shuttle_actix_web::ShuttleActixWeb;
use shuttle_runtime::CustomError;
use sqlx::Executor;
#[shuttle_runtime::main]
async fn actix_web(
#[shuttle_shared_db::Postgres] pool: sqlx::PgPool,
) -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Sen... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/main.rs | front/src/main.rs | #![allow(non_snake_case)]
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
mod components;
mod models;
use components::{FilmCard, FilmModal, Footer, Header};
use dioxus::prelude::*;
use models::FilmModalVisibility;
use shared::models::Film;
const API_ENDPOINT: &str = "api/v1... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/components/button.rs | front/src/components/button.rs | use dioxus::prelude::*;
use crate::models::ButtonType;
#[component]
pub fn Button<'a>(
cx: Scope<'a>,
button_type: ButtonType,
onclick: EventHandler<'a, MouseEvent>,
children: Element<'a>,
) -> Element {
cx.render(rsx!(button {
class: "text-slate-200 inline-flex items-center border-0 py-1 ... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/components/footer.rs | front/src/components/footer.rs | use dioxus::prelude::*;
pub fn Footer(cx: Scope) -> Element {
cx.render(rsx!(
footer {
class: "bg-blue-200 w-full h-16 p-2 box-border gap-6 flex flex-row justify-center items-center text-teal-950",
a {
class: "w-auto h-full",
href: "https://www.devbcn... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/components/film_modal.rs | front/src/components/film_modal.rs | use dioxus::prelude::*;
use shared::models::Film;
use uuid::Uuid;
use crate::components::Button;
use crate::models::{ButtonType, FilmModalVisibility};
#[derive(Props)]
pub struct FilmModalProps<'a> {
on_create_or_update: EventHandler<'a, Film>,
on_cancel: EventHandler<'a, MouseEvent>,
#[props(!optional)]
... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/components/header.rs | front/src/components/header.rs | use dioxus::prelude::*;
use crate::components::Button;
use crate::models::{ButtonType, FilmModalVisibility};
pub fn Header(cx: Scope) -> Element {
let is_modal_visible = use_shared_state::<FilmModalVisibility>(cx).unwrap();
cx.render(rsx!(
header {
class: "sticky top-0 z-10 text-gray-400 bg-blu... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/components/mod.rs | front/src/components/mod.rs | mod button;
mod film_card;
mod film_modal;
mod footer;
mod header;
pub use button::Button;
pub use film_card::FilmCard;
pub use film_modal::FilmModal;
pub use footer::Footer;
pub use header::Header;
| rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/components/film_card.rs | front/src/components/film_card.rs | use crate::{components::Button, models::ButtonType};
use dioxus::prelude::*;
use shared::models::Film;
#[component]
pub fn FilmCard<'a>(
cx: Scope<'a>,
film: &'a Film,
on_edit: EventHandler<'a, MouseEvent>,
on_delete: EventHandler<'a, MouseEvent>,
) -> Element {
cx.render(rsx!(
li {
... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/models/button.rs | front/src/models/button.rs | use std::fmt;
pub enum ButtonType {
Primary,
Secondary,
}
impl fmt::Display for ButtonType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
ButtonType::Primary => write!(f, "bg-blue-700 hover:bg-blue-800 active:bg-blue-900"),
ButtonType::Secondary => wr... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/models/film.rs | front/src/models/film.rs | pub struct FilmModalVisibility(pub bool);
| rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/front/src/models/mod.rs | front/src/models/mod.rs | mod button;
mod film;
pub use button::ButtonType;
pub use film::FilmModalVisibility;
| rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/shared/src/lib.rs | shared/src/lib.rs | pub mod models;
| rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
BcnRust/devbcn-workshop | https://github.com/BcnRust/devbcn-workshop/blob/0f45130131914a5458066a03ca19923807913ca1/shared/src/models.rs | shared/src/models.rs | use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "backend", derive(sqlx::FromRow))]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Default)]
pub struct Film {
pub id: uuid::Uuid,
pub title: String,
pub director: String,
#[cfg_attr(feature = "backend", sqlx(try_f... | rust | MIT | 0f45130131914a5458066a03ca19923807913ca1 | 2026-01-04T20:24:05.254453Z | false |
rust-embedded-community/usbd-serial | https://github.com/rust-embedded-community/usbd-serial/blob/822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892/src/lib.rs | src/lib.rs | //! CDC-ACM USB serial port implementation for [usb-device](https://crates.io/crates/usb-device).
//!
//! CDC-ACM is a USB class that's supported out of the box by most operating systems and used for
//! implementing modems and generic serial ports. The [`SerialPort`] class
//! implements a stream-like buffered serial ... | rust | MIT | 822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892 | 2026-01-04T20:24:12.282850Z | false |
rust-embedded-community/usbd-serial | https://github.com/rust-embedded-community/usbd-serial/blob/822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892/src/io.rs | src/io.rs | use super::SerialPort;
use core::borrow::BorrowMut;
use usb_device::bus::UsbBus;
#[derive(Debug)]
pub struct Error(usb_device::UsbError);
impl From<usb_device::UsbError> for Error {
fn from(e: usb_device::UsbError) -> Self {
Self(e)
}
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut co... | rust | MIT | 822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892 | 2026-01-04T20:24:12.282850Z | false |
rust-embedded-community/usbd-serial | https://github.com/rust-embedded-community/usbd-serial/blob/822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892/src/cdc_acm.rs | src/cdc_acm.rs | use core::convert::TryInto;
use core::mem;
use usb_device::Result;
use usb_device::class_prelude::*;
use usb_device::descriptor::lang_id::LangID;
use usb_device::device::DEFAULT_ALTERNATE_SETTING;
/// This should be used as `device_class` when building the `UsbDevice`.
pub const USB_CLASS_CDC: u8 = 0x02;
const USB_CL... | rust | MIT | 822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892 | 2026-01-04T20:24:12.282850Z | false |
rust-embedded-community/usbd-serial | https://github.com/rust-embedded-community/usbd-serial/blob/822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892/src/serial_port.rs | src/serial_port.rs | use crate::buffer::{Buffer, DefaultBufferStore};
use crate::cdc_acm::*;
use core::borrow::BorrowMut;
use core::slice;
use usb_device::Result;
use usb_device::class_prelude::*;
use usb_device::descriptor::lang_id::LangID;
/// USB (CDC-ACM) serial port with built-in buffering to implement stream-like behavior.
///
/// T... | rust | MIT | 822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892 | 2026-01-04T20:24:12.282850Z | false |
rust-embedded-community/usbd-serial | https://github.com/rust-embedded-community/usbd-serial/blob/822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892/src/buffer.rs | src/buffer.rs | use core::borrow::{Borrow, BorrowMut};
use core::{cmp, ptr};
/// A mediocre buffer that allows for block access without extra copies but memmoves more than
/// necessary.
///
/// wpos points to the first byte that can be written rpos points at the next byte that can be read
///
/// invariants: 0 <= rpos <= wpos <= dat... | rust | MIT | 822ae08a8a31f3be4a47eaf1a0b1149b4c4e5892 | 2026-01-04T20:24:12.282850Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/lib.rs | src/lib.rs | pub mod chat_template;
pub mod models;
pub mod position_embed;
pub mod tokenizer;
pub mod utils;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/api.rs | src/api.rs | use std::pin::pin;
use std::sync::{Arc, OnceLock};
use aha::models::{GenerateModel, ModelInstance, WhichModel, load_model};
use aha::utils::string_to_static_str;
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use rocket::futures::StreamExt;
use rocket::serde::json::Json;
use rocket::{
Request,... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/main.rs | src/main.rs | use std::{net::IpAddr, str::FromStr, time::Duration};
use aha::{models::WhichModel, utils::get_default_save_dir};
use clap::Parser;
use modelscope::ModelScope;
use rocket::{
Config,
data::{ByteUnit, Limits},
routes,
};
use tokio::time::sleep;
use crate::api::init;
mod api;
#[derive(Parser, Debug)]
#[comm... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/chat_template/mod.rs | src/chat_template/mod.rs | use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::{Result, anyhow};
use minijinja::{Environment, Value as MiniJinjaValue, context};
use crate::utils::string_to_static_str;
pub fn get_template(path: String) -> Result<String> {
let tokenizer_config_file = path.clone() + "/tokenizer_con... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/tokenizer/mod.rs | src/tokenizer/mod.rs | use anyhow::{Ok, Result, anyhow};
use candle_core::{Device, Tensor};
use tokenizers::Tokenizer;
pub struct TokenizerModel {
pub tokenizer: Tokenizer,
}
impl TokenizerModel {
pub fn init(path: &str) -> Result<Self> {
let path = path.to_string();
assert!(
std::path::Path::new(&path).... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/mod.rs | src/models/mod.rs | pub mod common;
pub mod deepseek_ocr;
pub mod hunyuan_ocr;
pub mod minicpm4;
pub mod paddleocr_vl;
pub mod qwen2_5vl;
pub mod qwen3vl;
pub mod rmbg2_0;
pub mod voxcpm;
use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::Result;
u... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/paddleocr_vl/config.rs | src/models/paddleocr_vl/config.rs | use candle_nn::Activation;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct PaddleOCRVLConfig {
pub compression_ratio: f64,
pub head_dim: usize,
pub hidden_act: Activation,
pub hidden_dropout_prob: f64,
pub hidden_size: usize,
pub ignored_index: i3... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/paddleocr_vl/processor.rs | src/models/paddleocr_vl/processor.rs | use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use candle_core::{DType, Device, IndexOp, Shape, Tensor};
use image::DynamicImage;
use crate::{
models::paddleocr_vl::config::PaddleOCRVLPreprocessorConfig,
utils::img_utils::{extract_images, img_smart_resize, img_transform... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/paddleocr_vl/model.rs | src/models/paddleocr_vl/model.rs | use anyhow::{Result, anyhow};
use candle_core::{D, IndexOp, Shape, Tensor};
use candle_nn::{
Conv2d, Embedding, LayerNorm, Linear, Module, RmsNorm, VarBuilder, embedding, linear,
linear_no_bias, rms_norm,
};
use num::integer::Roots;
use crate::{
models::{
common::{
NaiveAttnGateUpDownML... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/paddleocr_vl/mod.rs | src/models/paddleocr_vl/mod.rs | pub mod config;
pub mod generate;
pub mod model;
pub mod processor;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/paddleocr_vl/generate.rs | src/models/paddleocr_vl/generate.rs | use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Result, anyhow};
use candle_core::{D, DType, Device, IndexOp, Tensor};
use candle_nn::VarBuilder;
use rocket::async_stream::stream;
use rocket::futures::Stream;
use crate::mode... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen2_5vl/config.rs | src/models/qwen2_5vl/config.rs | use candle_nn::Activation;
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct VisionConfig {
pub depth: usize,
pub hidden_act: Activation,
pub hidden_size: usize,
pub intermediate_size: usize,
pub num_heads: usize,
pub in_chans: usize,
pub out_hidden_size: usize,
pub patc... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen2_5vl/processor.rs | src/models/qwen2_5vl/processor.rs | use std::collections::HashMap;
use aha_openai_dive::v1::resources::chat::{
ChatCompletionParameters, ChatMessage, ChatMessageContent, ChatMessageContentPart,
};
use anyhow::{Result, anyhow};
use candle_core::{DType, Device, IndexOp, Shape, Tensor};
#[cfg(feature = "ffmpeg")]
use ffmpeg_next as ffmpeg;
use image::D... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen2_5vl/model.rs | src/models/qwen2_5vl/model.rs | use anyhow::{Result, anyhow};
use candle_core::{D, DType, Device, IndexOp, Tensor};
use candle_nn::{Init, Linear, Module, RmsNorm, VarBuilder, linear, linear_no_bias, rms_norm};
use crate::{
models::{
common::{GateUpDownMLP, eager_attention_forward},
qwen2_5vl::config::{Qwen2_5VLConfig, RopeScaling... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | true |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen2_5vl/mod.rs | src/models/qwen2_5vl/mod.rs | pub mod config;
pub mod generate;
pub mod model;
pub mod processor;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen2_5vl/generate.rs | src/models/qwen2_5vl/generate.rs | use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Result, anyhow};
use candle_core::{D, DType, Device, IndexOp, Tensor};
use candle_nn::VarBuilder;
use rocket::async_stream::stream;
use rocket::futures::Stream;
use crate::mode... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/minicpm4.rs | src/models/voxcpm/minicpm4.rs | use anyhow::{Ok, Result, anyhow};
use candle_core::{D, DType, Device, Tensor};
use candle_nn::{Embedding, Module, RmsNorm, VarBuilder, embedding, rms_norm};
use crate::{
models::{
common::{GateUpDownMLP, NaiveAttention},
voxcpm::config::VoxMiniCPM4Config,
},
position_embed::rope::compute_de... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/config.rs | src/models/voxcpm/config.rs | #[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct VoxRopeScalingConfig {
pub r#type: String,
pub long_factor: Vec<f32>,
pub short_factor: Vec<f32>,
pub original_max_position_embeddings: usize,
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct VoxMiniCPM4Config {
pu... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/model.rs | src/models/voxcpm/model.rs | use std::{cmp::max, collections::HashMap, f64};
use anyhow::{Ok, Result};
use candle_core::{D, DType, Device, IndexOp, Tensor};
use candle_nn::{Linear, Module, VarBuilder, linear, linear_no_bias};
use candle_transformers::models::deepseek2::SplitOp;
use crate::{
models::voxcpm::{
audio_vae::AudioVAE,
... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/mod.rs | src/models/voxcpm/mod.rs | pub mod audio_vae;
pub mod config;
pub mod generate;
pub mod minicpm4;
pub mod model;
pub mod tokenizer;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/audio_vae.rs | src/models/voxcpm/audio_vae.rs | use anyhow::{Ok, Result};
use candle_core::{D, Tensor};
use candle_nn::{Conv1d, Conv1dConfig, ConvTranspose1d, ConvTranspose1dConfig, Module, VarBuilder};
pub struct CausalConv1d {
conv1d: Conv1d,
padding: usize,
}
impl CausalConv1d {
pub fn new(
weight: Tensor,
bias: Option<Tensor>,
... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/tokenizer.rs | src/models/voxcpm/tokenizer.rs | use anyhow::{Ok, Result, anyhow};
use tokenizers::Tokenizer;
pub struct SingleChineseTokenizer {
tokenizer: Tokenizer,
multichar_tokens: Vec<String>,
}
impl SingleChineseTokenizer {
pub fn new(path: &str) -> Result<Self> {
let path = path.to_string();
assert!(
std::path::Path::... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/voxcpm/generate.rs | src/models/voxcpm/generate.rs | use std::collections::HashMap;
use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Ok, Result};
use base64::{Engine, prelude::BASE64_STANDARD};
use candle_core::{DType, Device, Tensor, pickle::read_all_with_key};
use candle_nn::... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/rmbg2_0/model.rs | src/models/rmbg2_0/model.rs | use anyhow::{Result, anyhow};
use candle_core::{D, DType, Device, IndexOp, Shape, Tensor};
use candle_nn::{
Activation, BatchNorm, Conv2d, Init, LayerNorm, Linear, Module, ModuleT, VarBuilder, linear,
linear_no_bias, ops::sigmoid,
};
use crate::{
models::common::{
TwoLinearMLP, deform_conv2d_kernel... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | true |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/rmbg2_0/mod.rs | src/models/rmbg2_0/mod.rs | pub mod generate;
pub mod model;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/rmbg2_0/generate.rs | src/models/rmbg2_0/generate.rs | use std::io::Cursor;
use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::Result;
use base64::{Engine, prelude::BASE64_STANDARD};
use candle_core::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use image::RgbaImage;
use rayon... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen3vl/config.rs | src/models/qwen3vl/config.rs | use candle_nn::Activation;
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct Size {
pub longest_edge: usize,
pub shortest_edge: usize,
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct PreprocessorConfig {
pub size: Size,
pub patch_size: usize,
pub temporal_patch_... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen3vl/processor.rs | src/models/qwen3vl/processor.rs | use std::collections::HashMap;
use aha_openai_dive::v1::resources::chat::{
ChatCompletionParameters, ChatMessage, ChatMessageContent, ChatMessageContentPart,
};
use anyhow::{Result, anyhow};
use candle_core::{DType, Device, IndexOp, Shape, Tensor};
#[cfg(feature = "ffmpeg")]
use ffmpeg_next as ffmpeg;
use image::D... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen3vl/model.rs | src/models/qwen3vl/model.rs | use anyhow::{Result, anyhow};
use candle_core::{D, DType, IndexOp, Shape, Tensor};
use candle_nn::{
Activation, Embedding, Init, LayerNorm, Linear, Module, RmsNorm, VarBuilder, embedding, linear,
linear_no_bias, rms_norm,
};
use crate::{
models::{
common::{GateUpDownMLP, TwoLinearMLP, eager_attenti... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | true |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen3vl/mod.rs | src/models/qwen3vl/mod.rs | pub mod config;
pub mod generate;
pub mod model;
pub mod processor;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/qwen3vl/generate.rs | src/models/qwen3vl/generate.rs | use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Result, anyhow};
use candle_core::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use rocket::async_stream::stream;
use rocket::futures::Stream;
use crate::{
chat_templ... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/common/mod.rs | src/models/common/mod.rs | use anyhow::Result;
use candle_core::{D, Tensor};
use candle_nn::{
Activation, BatchNorm, BatchNormConfig, Conv2d, Conv2dConfig, LayerNorm, LayerNormConfig,
Linear, Module, RmsNorm, VarBuilder, batch_norm, conv2d, conv2d_no_bias, layer_norm, linear,
linear_no_bias, rms_norm,
};
use crate::{position_embed::... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/deepseek_ocr/config.rs | src/models/deepseek_ocr/config.rs | #[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct DeepseekV2Config {
pub bos_token_id: u32,
pub eos_token_id: u32,
pub first_k_dense_replace: usize,
pub hidden_size: usize,
pub intermediate_size: usize,
pub kv_lora_rank: Option<usize>,
pub lm_head: bool,
pub max_position_... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/deepseek_ocr/processor.rs | src/models/deepseek_ocr/processor.rs | use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use candle_core::{DType, Device, Tensor};
use crate::utils::img_utils::dynamic_preprocess;
use crate::{
tokenizer::TokenizerModel,
utils::{
extract_mes,
img_utils::{extract_images, img_transform, resize_with... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/deepseek_ocr/model.rs | src/models/deepseek_ocr/model.rs | use anyhow::Result;
use candle_core::{D, IndexOp, Tensor};
use candle_nn::{
Activation, Conv2d, Embedding, Init, LayerNorm, Linear, Module, RmsNorm, VarBuilder, embedding,
linear, linear_no_bias,
ops::{sigmoid, softmax},
rms_norm,
};
use candle_transformers::models::segment_anything::LayerNorm2d;
use c... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | true |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/deepseek_ocr/mod.rs | src/models/deepseek_ocr/mod.rs | pub mod config;
pub mod generate;
pub mod model;
pub mod processor;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/deepseek_ocr/generate.rs | src/models/deepseek_ocr/generate.rs | use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Result, anyhow};
use candle_core::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use rocket::async_stream::stream;
use rocket::futures::Stream;
use crate::{
models::{
... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/minicpm4/config.rs | src/models/minicpm4/config.rs | use candle_nn::Activation;
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struct RopeScalingConfig {
pub rope_type: String,
pub long_factor: Vec<f32>,
pub short_factor: Vec<f32>,
pub original_max_position_embeddings: usize,
}
#[derive(Debug, Clone, PartialEq, serde::Deserialize)]
pub struc... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/minicpm4/model.rs | src/models/minicpm4/model.rs | use anyhow::{Ok, Result};
use candle_core::{D, Device, Tensor};
use candle_nn::{Embedding, Linear, Module, RmsNorm, VarBuilder, embedding, rms_norm};
use crate::{
models::{
common::{GateUpDownMLP, NaiveAttention},
minicpm4::config::MiniCPM4Config,
},
position_embed::rope::compute_default_ro... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/minicpm4/mod.rs | src/models/minicpm4/mod.rs | pub mod config;
pub mod generate;
pub mod model;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/minicpm4/generate.rs | src/models/minicpm4/generate.rs | use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Result, anyhow};
use candle_core::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use rocket::async_stream::stream;
use rocket::futures::Stream;
use crate::models::minicpm4... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/hunyuan_ocr/config.rs | src/models/hunyuan_ocr/config.rs | use candle_nn::Activation;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct HunYuanVLConfig {
pub attention_bias: bool,
pub attention_dropout: f64,
pub attention_head_dim: usize,
pub bos_token_id: u32,
pub eod_token_id: u32,
pub eos_toke... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/hunyuan_ocr/processor.rs | src/models/hunyuan_ocr/processor.rs | use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use candle_core::{DType, Device, IndexOp, Shape, Tensor};
use image::DynamicImage;
use crate::{
models::hunyuan_ocr::config::HunyuanOCRPreprocessorConfig,
tokenizer::TokenizerModel,
utils::{
img_utils::{extract_... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/hunyuan_ocr/model.rs | src/models/hunyuan_ocr/model.rs | use anyhow::{Result, anyhow};
use candle_core::{D, IndexOp, Tensor};
use candle_nn::{
Conv2d, Embedding, Init, Linear, Module, RmsNorm, VarBuilder, embedding, linear,
linear_no_bias, rms_norm,
};
use crate::{
models::{
common::{GateUpDownMLP, NaiveAttnTwoLinearMLPBlock, eager_attention_forward, get... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/hunyuan_ocr/mod.rs | src/models/hunyuan_ocr/mod.rs | pub mod config;
pub mod generate;
pub mod model;
pub mod processor;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/models/hunyuan_ocr/generate.rs | src/models/hunyuan_ocr/generate.rs | use aha_openai_dive::v1::resources::chat::{
ChatCompletionChunkResponse, ChatCompletionParameters, ChatCompletionResponse,
};
use anyhow::{Result, anyhow};
use candle_core::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use rocket::async_stream::stream;
use rocket::futures::Stream;
use crate::{
chat_templ... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/utils/audio_utils.rs | src/utils/audio_utils.rs | use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::{f64::consts::PI, io::Cursor};
use aha_openai_dive::v1::resources::chat::{
ChatCompletionParameters, ChatCompletionResponse, ChatMessage, ChatMessageContent,
ChatMessageContentPart,
};
use anyhow::{Result, anyhow};
use base64::Engi... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/utils/video_utils.rs | src/utils/video_utils.rs | // use std::{fs::File, io::Write};
// use ffmpeg_next as ffmpeg;
// #[allow(unused)]
// fn save_file(
// frame: &ffmpeg::frame::Video,
// index: usize,
// ) -> std::result::Result<(), std::io::Error> {
// let mut file = File::create(format!("frame{}.ppm", index))?;
// file.write_all(format!("P6\n{} {}... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/utils/img_utils.rs | src/utils/img_utils.rs | use std::io::Cursor;
use std::{collections::HashSet, path::PathBuf};
use aha_openai_dive::v1::resources::chat::{
ChatCompletionParameters, ChatMessage, ChatMessageContent, ChatMessageContentPart,
};
use anyhow::{Result, anyhow};
use base64::{Engine, engine::general_purpose};
use candle_core::{DType, Device, Tensor... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/utils/mod.rs | src/utils/mod.rs | pub mod audio_utils;
pub mod img_utils;
pub mod tensor_utils;
pub mod video_utils;
use std::{fs, process::Command};
use aha_openai_dive::v1::resources::{
chat::{
AudioUrlType, ChatCompletionChoice, ChatCompletionChunkChoice, ChatCompletionChunkResponse,
ChatCompletionParameters, ChatCompletionResp... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/utils/tensor_utils.rs | src/utils/tensor_utils.rs | use anyhow::{Result, anyhow};
use candle_core::{D, DType, Device, IndexOp, Tensor, shape::Dim};
use candle_nn::ops::sigmoid;
pub fn prepare_causal_attention_mask(
b_size: usize,
tgt_len: usize,
seqlen_offset: usize,
device: &Device,
) -> Result<Tensor> {
// Sliding window mask?
// let mask: Vec... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/position_embed/rope.rs | src/position_embed/rope.rs | use anyhow::Result;
use candle_core::{D, DType, Device, IndexOp, Tensor};
use candle_transformers::models::deepseek2::SplitOp;
use crate::utils::tensor_utils::{index_select_2d, split_tensor};
pub fn compute_default_rope_parameters(dim: usize, base: f32) -> Vec<f32> {
let inv_freq: Vec<f32> = (0..dim)
.ste... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/src/position_embed/mod.rs | src/position_embed/mod.rs | pub mod rope;
| rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/messy_test.rs | tests/messy_test.rs | use anyhow::Result;
use candle_core::Tensor;
#[test]
fn messy_test() -> Result<()> {
// RUST_BACKTRACE=1 cargo test -F cuda messy_test -r -- --nocapture
let device = &candle_core::Device::Cpu;
// let path = get_default_save_dir();
let x = Tensor::arange(0.0, 9.0, device)?;
println!("x: {}", x);
... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_paddleocr_vl.rs | tests/test_paddleocr_vl.rs | use std::{pin::pin, time::Instant};
use aha::models::{GenerateModel, paddleocr_vl::generate::PaddleOCRVLGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn paddleocr_vl_generate() -> Result<()> {
// RUST_BACKTRACE=1 car... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_minicpm4.rs | tests/test_minicpm4.rs | use std::{pin::pin, time::Instant};
use aha::models::{GenerateModel, minicpm4::generate::MiniCPMGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn minicpm_generate() -> Result<()> {
// test with cpu :(太慢了, : RUST_BACKT... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/config_tests.rs | tests/config_tests.rs | use aha::models::{
deepseek_ocr::config::DeepseekOCRConfig, hunyuan_ocr::config::HunYuanVLConfig,
minicpm4::config::MiniCPM4Config, paddleocr_vl::config::PaddleOCRVLConfig,
qwen2_5vl::config::Qwen2_5VLConfig, qwen3vl::config::Qwen3VLConfig,
voxcpm::config::VoxCPMConfig,
};
use anyhow::Result;
#[test]
f... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_qwen2_5vl.rs | tests/test_qwen2_5vl.rs | use std::{pin::pin, time::Instant};
use aha::models::{GenerateModel, qwen2_5vl::generate::Qwen2_5VLGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn qwen2_5vl_generate() -> Result<()> {
// test with cpu :(太慢了, : RUST_... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_voxcpm.rs | tests/test_voxcpm.rs | use std::time::Instant;
use aha::{
models::{
GenerateModel,
voxcpm::{generate::VoxCPMGenerate, tokenizer::SingleChineseTokenizer},
},
utils::audio_utils::{extract_and_save_audio_from_response, save_wav},
};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::{Ok,... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_qwen3vl.rs | tests/test_qwen3vl.rs | use std::{pin::pin, time::Instant};
use aha::models::{GenerateModel, qwen3vl::generate::Qwen3VLGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn qwen3vl_generate() -> Result<()> {
// test with cuda: RUST_BACKTRACE=1 c... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/weight_test.rs | tests/weight_test.rs | use std::collections::HashMap;
use aha::utils::{find_type_files, get_device};
use anyhow::Result;
use candle_core::{Device, pickle::read_all_with_key, safetensors};
use candle_nn::VarBuilder;
#[test]
fn minicpm4_weight() -> Result<()> {
let model_path = "/home/jhq/huggingface_model/OpenBMB/MiniCPM4-0.5B/";
le... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_rmbg2_0.rs | tests/test_rmbg2_0.rs | use std::time::Instant;
use aha::models::rmbg2_0::generate::RMBG2_0Model;
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
#[test]
fn rmbg2_0_generate() -> Result<()> {
// test with cuda: RUST_BACKTRACE=1 cargo test -F cuda rmbg2_0_generate -r -- --nocapture
let model_p... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_voxcpm1_5.rs | tests/test_voxcpm1_5.rs | use std::time::Instant;
use aha::{
models::{
GenerateModel,
voxcpm::{generate::VoxCPMGenerate, tokenizer::SingleChineseTokenizer},
},
utils::audio_utils::{extract_and_save_audio_from_response, save_wav},
};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::{Ok,... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_deepseek_ocr.rs | tests/test_deepseek_ocr.rs | use std::{pin::pin, time::Instant};
use aha::models::{GenerateModel, deepseek_ocr::generate::DeepseekOCRGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn deepseek_ocr_generate() -> Result<()> {
// RUST_BACKTRACE=1 car... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_hunyuan_ocr.rs | tests/test_hunyuan_ocr.rs | use std::{pin::pin, time::Instant};
use aha::models::{GenerateModel, hunyuan_ocr::generate::HunyuanOCRGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
use rocket::futures::StreamExt;
#[test]
fn hunyuan_ocr_generate() -> Result<()> {
// RUST_BACKTRACE=1 cargo ... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_robo_brain.rs | tests/test_robo_brain.rs | use std::time::Instant;
use aha::models::{GenerateModel, qwen2_5vl::generate::Qwen2_5VLGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
#[test]
fn robo_brain_generate() -> Result<()> {
// test with cuda: RUST_BACKTRACE=1 cargo test -F cuda robo_brain_generate... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_gelab_zero.rs | tests/test_gelab_zero.rs | use std::time::Instant;
use aha::models::{GenerateModel, qwen3vl::generate::Qwen3VLGenerateModel};
use aha_openai_dive::v1::resources::chat::ChatCompletionParameters;
use anyhow::Result;
#[test]
fn gelab_zero_generate() -> Result<()> {
// test with cuda: RUST_BACKTRACE=1 cargo test -F cuda gelab_zero_generate -r ... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
jhqxxx/aha | https://github.com/jhqxxx/aha/blob/3ba4de8a7dd578b809fa4676f865a438abba91ab/tests/test_rmbg2_0_perf.rs | tests/test_rmbg2_0_perf.rs | use std::time::Instant;
use anyhow::Result;
use image::{ImageReader, Rgba, RgbaImage};
use rayon::prelude::*;
/// 测试像素组合性能对比
#[test]
fn test_pixel_combine_performance() -> Result<()> {
// cargo test test_pixel_combine_performance -r -- --nocapture
let img_path = "./assets/img/gougou.jpg";
let img = ImageR... | rust | Apache-2.0 | 3ba4de8a7dd578b809fa4676f865a438abba91ab | 2026-01-04T20:22:58.809484Z | false |
fMeow/arangors | https://github.com/fMeow/arangors/blob/4ee57cfdce34a504d94108dedce5abc11809de87/src/user.rs | src/user.rs | use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
use typed_builder::TypedBuilder;
#[derive(Debug, Clone, Serialize, Deserialize, TypedBuilder)]
pub struct User {
#[serde(rename = "user")]
pub username: String,
#[serde(rename = "passwd")]
password: Option<String... | rust | MIT | 4ee57cfdce34a504d94108dedce5abc11809de87 | 2026-01-04T20:24:21.210590Z | false |
fMeow/arangors | https://github.com/fMeow/arangors/blob/4ee57cfdce34a504d94108dedce5abc11809de87/src/lib.rs | src/lib.rs | //! [](https://github.com/fMeow/arangors/actions)
//! [](./LICENSE)
//! [](https://crates.io/crat... | rust | MIT | 4ee57cfdce34a504d94108dedce5abc11809de87 | 2026-01-04T20:24:21.210590Z | false |
fMeow/arangors | https://github.com/fMeow/arangors/blob/4ee57cfdce34a504d94108dedce5abc11809de87/src/index.rs | src/index.rs | //! This module facilitates the building of new indexes as well as the retrieval
//! of existing indexes in ArangoDB.
//! The following types are supported:
//!
//! * Fulltext
//! * Geo
//! * Hash
//! * Persistent
//! * Skiplist
//! * Ttl (Time to live)
//!
//! An index of type [Primary] cannot be created and is only a... | rust | MIT | 4ee57cfdce34a504d94108dedce5abc11809de87 | 2026-01-04T20:24:21.210590Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.