Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
1b1265e6
Unverified
Commit
1b1265e6
authored
Oct 08, 2025
by
Graham King
Committed by
GitHub
Oct 08, 2025
Browse files
chore: Remove GGUF support (#3488)
Signed-off-by:
Graham King
<
grahamk@nvidia.com
>
parent
0c4c4d1d
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
76 deletions
+1
-76
lib/llm/src/preprocessor/prompt/template.rs
lib/llm/src/preprocessor/prompt/template.rs
+0
-4
lib/llm/src/preprocessor/prompt/template/tokcfg.rs
lib/llm/src/preprocessor/prompt/template/tokcfg.rs
+1
-71
lib/llm/tests/model_card.rs
lib/llm/tests/model_card.rs
+0
-1
No files found.
lib/llm/src/preprocessor/prompt/template.rs
View file @
1b1265e6
...
...
@@ -68,10 +68,6 @@ impl PromptFormatter {
PromptFormatterArtifact
::
HfChatTemplate
(
_
)
=>
Err
(
anyhow
::
anyhow!
(
"prompt_formatter should not have type HfChatTemplate"
)),
PromptFormatterArtifact
::
GGUF
(
gguf_path
)
=>
{
let
config
=
ChatTemplate
::
from_gguf
(
gguf_path
)
?
;
Self
::
from_parts
(
config
,
ContextMixins
::
default
())
}
}
}
...
...
lib/llm/src/preprocessor/prompt/template/tokcfg.rs
View file @
1b1265e6
...
...
@@ -3,12 +3,10 @@
//based on: https://github.com/EricLBuehler/mistral.rs/blob/d970bb5feb863acf8e8ec90de97e18221fb959f1/mistralrs-core/src/pipeline/chat_template.rs
use
std
::
{
collections
::
HashMap
,
fs
::
File
,
path
::
Path
}
;
use
std
::
collections
::
HashMap
;
use
chrono
::{
DateTime
,
Local
};
use
either
::
Either
;
use
ggus
::{
GGufMetaKV
,
GGufReader
};
use
memmap2
::
Mmap
;
use
minijinja
::{
Error
,
ErrorKind
,
Value
,
value
::
Kwargs
};
use
serde
::{
Deserialize
,
Serialize
};
...
...
@@ -82,74 +80,6 @@ pub struct ChatTemplate {
}
impl
ChatTemplate
{
pub
fn
from_gguf
(
path
:
&
Path
)
->
anyhow
::
Result
<
Self
>
{
let
file
=
match
File
::
open
(
path
)
{
Ok
(
f
)
=>
unsafe
{
Mmap
::
map
(
&
f
)
?
},
Err
(
e
)
=>
{
anyhow
::
bail!
(
"Failed to open file '{}': {e:?}"
,
path
.display
());
}
};
let
mut
reader
=
GGufReader
::
new
(
&
file
);
let
header
=
match
reader
.read_header
()
{
Ok
(
header
)
=>
header
,
Err
(
e
)
=>
{
anyhow
::
bail!
(
"Failed to read GGUF header of {}: {e:?}"
,
path
.display
());
}
};
let
num_metadata
=
header
.metadata_kv_count
;
let
mut
out
=
ChatTemplate
::
default
();
// bos/eos/unk token conversion
fn
convert
(
kv
:
GGufMetaKV
)
->
Option
<
BeginEndUnkTok
>
{
let
id_string
:
String
=
kv
.read_unsigned
()
.to_string
();
Some
(
BeginEndUnkTok
(
Either
::
Left
(
id_string
)))
}
let
mut
num_found
=
0
;
let
num_expected
=
4
;
// How many fields we need
for
_
in
0
..
num_metadata
{
let
kv
=
match
reader
.read_meta_kv
()
{
Ok
(
kv
)
=>
kv
,
Err
(
err
)
=>
anyhow
::
bail!
(
"read_meta_kv error in '{}': {err:?}"
,
path
.display
()),
};
match
kv
.key
()
{
"tokenizer.ggml.bos_token_id"
=>
{
out
.bos_token
=
convert
(
kv
);
num_found
+=
1
;
}
"tokenizer.ggml.eos_token_id"
=>
{
out
.eos_token
=
convert
(
kv
);
num_found
+=
1
;
}
"tokenizer.ggml.unknown_token_id"
=>
{
out
.unk_token
=
convert
(
kv
);
num_found
+=
1
;
}
"tokenizer.chat_template"
=>
{
out
.chat_template
=
kv
.value_reader
()
.read_str
()
.ok
()
.map
(|
s
|
ChatTemplateValue
(
Either
::
Left
(
s
.to_string
())));
num_found
+=
1
;
}
_
=>
{}
}
if
num_found
==
num_expected
{
// No need to look at any more keys
break
;
}
}
Ok
(
out
)
}
// pub fn has_chat_template(&self) -> bool {
// self.chat_template.is_some()
// }
pub
fn
eos_tok
(
&
self
)
->
Option
<
String
>
{
match
self
.eos_token
.as_ref
()
?
.0
{
Either
::
Left
(
ref
lit
)
=>
Some
(
lit
.clone
()),
...
...
lib/llm/tests/model_card.rs
View file @
1b1265e6
...
...
@@ -30,7 +30,6 @@ async fn test_tokenizer_from_hf_like_local_repo() {
// Verify tokenizer file was found
match
mdc
.tokenizer
.unwrap
()
{
TokenizerKind
::
HfTokenizerJson
(
_
)
=>
(),
TokenizerKind
::
GGUF
(
_
)
=>
(),
}
}
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment