Skip to content
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

Integrate ModularTokenizerOp with Hugging Face remote 🤗 #368

Merged
merged 6 commits into from
Sep 18, 2024

Conversation

SagiPolaczek
Copy link
Collaborator

@SagiPolaczek SagiPolaczek commented Sep 15, 2024

Supporting HF-like API to integrate the modular_tokenizer_op with HF remote.

API:

from fuse.data.tokenizers.modular_tokenizer.op import ModularTokenizerOp

tokenizer_op = ModularTokenizerOp.from_pretrained("repo/id")
# OR 
tokenizer_op = ModularTokenizerOp.from_pretrained("/local/path/to/tokenizer/dir")

@@ -58,7 +58,7 @@ exclude =


[mypy]
python_version = 3.7
python_version = 3.9
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due mypy pre-commit errors

Comment on lines +554 to +556
def save_pretrained(self, save_directory: Union[str, Path]) -> None:
print(f"Saving @ {save_directory=}")
self._tokenizer.save(path=str(save_directory))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, all of the information is being stored in tokenizer. That's why it's enough to save it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

cache_dir: Optional[Union[str, Path]] = None,
local_files_only: bool = False,
revision: Optional[str] = None,
) -> "ModularTokenizerOp":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment that for arguments details directs to snapshot_download

mosheraboh
mosheraboh previously approved these changes Sep 18, 2024
Copy link
Collaborator

@mosheraboh mosheraboh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Added inline suggestion to consider.

@SagiPolaczek SagiPolaczek merged commit cacee32 into master Sep 18, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants