Skip to content

Commit

Permalink
build(xtask): update deps
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <ydrml@hotmail.com>
  • Loading branch information
YdrMaster committed Dec 10, 2024
1 parent 2363370 commit 2860600
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ members = ["ggus", "ggml-quants", "xtask"]
resolver = "2"

[workspace.dependencies]
indexmap = "2.6"
indexmap = "2.7"
rayon = "1.10"
2 changes: 1 addition & 1 deletion xtask/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "gguf-utils"
description = "Utilities for handling gguf files"
version = "0.0.0"
version = "0.0.1"
edition = "2021"
authors = ["YdrMaster <ydrml@hotmail.com>"]
repository = "https://github.com/InfiniTensor/gguf"
Expand Down
22 changes: 13 additions & 9 deletions xtask/src/utils/operator/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,23 @@ impl Content<'_> {
"llama" => {
let [mat, embd, norm, else_] =
["mat", "embd", "norm", "else"].map(|name| types.get(name).copied());
self.cast_(mat, |name, shape| match name {
"token_embd.weight" | "output.weight" => embd,
_ if name.ends_with("_norm.weight") => norm,
_ if shape.len() > 1 => mat,
_ => else_,
self.cast_(mat, |name, shape| {
if matches!(name, "token_embd.weight" | "output.weight") {
embd
} else if name.ends_with("_norm.weight") {
norm
} else if shape.len() > 1 {
mat
} else {
else_
}
})
}
"clip" => {
let [weight, embd, norm, else_] =
["weight", "embd", "norm", "else"].map(|name| types.get(name).copied());
self.cast_(weight, |name, _| match name.strip_prefix("v.") {
Some(name) => {
self.cast_(weight, |name, _| {
name.strip_prefix("v.").map_or(else_, |name| {
if name.contains("embd") {
embd
} else if name.contains("ln") {
Expand All @@ -51,8 +56,7 @@ impl Content<'_> {
} else {
weight
}
}
None => else_,
})
})
}
arch => panic!("Unsupported architecture: {arch}"),
Expand Down

0 comments on commit 2860600

Please sign in to comment.