Skip to content

Commit

Permalink
Add aksr support for Embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
jamjamjon committed Oct 29, 2024
1 parent 60621d6 commit 6c3290e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ natord = "1.0.9"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
minifb = "0.27.0"
aksr = { git = "https://github.com/jamjamjon/aksr.git" }
aksr = "0.0.1"


[features]
Expand Down
10 changes: 3 additions & 7 deletions src/ys/embedding.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use aksr::Builder;
use anyhow::Result;
use ndarray::{Array, Axis, Ix2, IxDyn};

use crate::X;

/// Embedding for image or text.
#[derive(Clone, PartialEq, Default)]
pub struct Embedding(Array<f32, IxDyn>);
#[derive(Builder, Clone, PartialEq, Default)]
pub struct Embedding(#[args(alias = "embedding")] Array<f32, IxDyn>);

impl std::fmt::Debug for Embedding {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Expand All @@ -24,11 +25,6 @@ impl Embedding {
Self(x)
}

pub fn with_embedding(mut self, x: Array<f32, IxDyn>) -> Self {
self.0 = x;
self
}

pub fn data(&self) -> &Array<f32, IxDyn> {
&self.0
}
Expand Down

0 comments on commit 6c3290e

Please sign in to comment.