Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit019ba1d

Browse files
authored
convert : fix Baichuan2 models by using vocab size in config.json (ggml-org#3299)
Use local GGUF package when possible in Baichuan converter
1 parentbeabc8c commit019ba1d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎convert-baichuan-hf-to-gguf.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
frompathlibimportPath
1212
fromtypingimportTYPE_CHECKING,Any
1313
importitertools
14-
importgguf
1514
importnumpyasnp
1615
importtorch
1716
fromsentencepieceimportSentencePieceProcessor# type: ignore[import]
1817

18+
if'NO_LOCAL_GGUF'notinos.environ:
19+
sys.path.insert(1,str(Path(__file__).parent/'gguf-py'/'gguf'))
20+
importgguf
21+
1922

2023
ifTYPE_CHECKING:
2124
fromtypingimportTypeAlias
@@ -174,8 +177,11 @@ def parse_args() -> argparse.Namespace:
174177
print("gguf: get sentencepiece tokenizer vocab, scores and token types")
175178

176179
tokenizer=SentencePieceProcessor(str(tokenizer_model_file))
180+
vocab_size=hparams.get('vocab_size')
181+
ifvocab_sizeisNone:
182+
vocab_size=tokenizer.vocab_size()
177183

178-
foriinrange(tokenizer.vocab_size()):
184+
foriinrange(vocab_size):
179185
text:bytes
180186
score:float
181187

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp