10000 convert : fix python 3.8 support, modernize type annotations by cebtenzzre · Pull Request #2916 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

convert : fix python 3.8 support, modernize type annotations #2916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
convert : add necessary type: ignore comments
  • Loading branch information
cebtenzzre committed Aug 30, 2023
commit 8a8c1cb0f2881bb5172c13c55e22ea80c72bef5a
2 changes: 1 addition & 1 deletion convert-falcon-hf-to-gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import gguf
import numpy as np
import torch
from transformers import AutoTokenizer
from transformers import AutoTokenizer # type: ignore[import]


def bytes_to_unicode():
Expand Down
2 changes: 1 addition & 1 deletion convert-gptneox-hf-to-gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import gguf
import numpy as np
import torch
from transformers import AutoTokenizer
from transformers import AutoTokenizer # type: ignore[import]

# ref: https://github.com/openai/gpt-2/blob/master/src/encoder.py

Expand Down
2 changes: 1 addition & 1 deletion convert-llama-7b-pth-to-gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import gguf
import numpy as np
import torch
from sentencepiece import SentencePieceProcessor
from sentencepiece import SentencePieceProcessor # type: ignore[import]

if TYPE_CHECKING:
from typing import TypeAlias
Expand Down
2 changes: 1 addition & 1 deletion convert-llama-hf-to-gguf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import gguf
import numpy as np
import torch
from sentencepiece import SentencePieceProcessor
from sentencepiece import SentencePieceProcessor # type: ignore[import]

if TYPE_CHECKING:
from typing import TypeAlias
Expand Down
4 changes: 2 additions & 2 deletions convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import gguf
import numpy as np
from sentencepiece import SentencePieceProcessor # type: ignore
from sentencepiece import SentencePieceProcessor # type: ignore[import]

if TYPE_CHECKING:
from typing import TypeAlias
Expand Down Expand Up @@ -338,7 +338,7 @@ def __init__(self, fname_tokenizer: Path, fname_added_tokens: Path | None) -> No

def bpe_tokens(self) -> Iterable[tuple[bytes, float, gguf.TokenType]]:
tokenizer = self.bpe_tokenizer
from transformers.models.gpt2 import tokenization_gpt2
from transformers.models.gpt2 import tokenization_gpt2 # type: ignore[import]
byte_encoder = tokenization_gpt2.bytes_to_unicode()
byte_decoder = {v: k for k, v in byte_encoder.items()}
for i, item in enumerate(tokenizer):
Expand Down
0