Skip to content

Commit

Permalink
Return full state as embedding if embed layer requested is larger tha…
Browse files Browse the repository at this point in the history
…n model's layer count.
  • Loading branch information
cryscan committed Jan 10, 2025
1 parent 5ae9de6 commit 11954e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/ai00-core/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,11 @@ impl Runtime {

let backed = self.state.back(batch).await?;
if let GenerateKind::Embed { layer } = context.request.kind {
let layer = layer.clamp(0, self.info.num_layer - 1);
let backed = backed.clone();
let embed = self.state.embed(layer, backed)?.to_vec();
let embed = match layer {
x if x < self.info.num_layer => self.state.embed(layer, backed)?.to_vec(),
_ => backed.to_vec(),
};
let _ = context.sender.send(Token::Embed(embed));
}

Expand Down

0 comments on commit 11954e0

Please sign in to comment.