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

sortedTokenBytes doesn't seem necessary #38

Open
stoneflying opened this issue Aug 28, 2023 · 1 comment
Open

sortedTokenBytes doesn't seem necessary #38

stoneflying opened this issue Aug 28, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@stoneflying
Copy link

Thank you for your efforts. I found that in the NewCoreBPE function, the result of the following code does not seem to be used anywhere,

        sortedTokenBytes := make([][]byte, 0, len(encoder))
	for k := range encoder {
		sortedTokenBytes = append(sortedTokenBytes, []byte(k))
	}
	sort.Slice(sortedTokenBytes, func(i, j int) bool {
		return bytes.Compare(sortedTokenBytes[i], sortedTokenBytes[j]) < 0
	})

	return &CoreBPE{
		......
		sortedTokenBytes:     sortedTokenBytes,
	}, nil

but this sorting operation seems to be very expensive. Is there any consideration here?

@pkoukk
Copy link
Owner

pkoukk commented Sep 4, 2023

Yes, this code currently is not necessary.
This variable is mainly used when multi-threaded encoding is needed, but this feature has not been implemented yet.
I will implement it later, maybe this week.

@pkoukk pkoukk added the enhancement New feature or request label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants
@pkoukk @stoneflying and others