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

Handle char level tokenization #11

Merged
merged 4 commits into from
Feb 18, 2024

Conversation

brianhie
Copy link
Contributor

Add char level tokenizer, modify generation code to handle batched inference with char tok

@@ -76,6 +86,7 @@ def generate(
mem_after_tok = torch.cuda.memory_allocated(device=x.device) / 1e9
print_rank_0(f"Memory after tokenization: {mem_after_tok} GB")
print_rank_0("Starting generation...")
torch.cuda.memory._record_memory_history(enabled=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be on by default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

generation[:, : i + 1],
skip_special_tokens=skip_special_tokens,
)
if isinstance(self.tokenizer, CharLevelTokenizer):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe could slightly reformat this to have different args depending on the Tokenizer class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reformatted

@Zymrael
Copy link
Contributor

Zymrael commented Feb 18, 2024

Also run black and isort!

@brianhie
Copy link
Contributor Author

Also run black and isort!

Done 😄

@Zymrael Zymrael merged commit 37caf4d into togethercomputer:main Feb 18, 2024
3 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