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

mpt: utf-8 support, perplexity testing, repeat penalty sampling #184

Merged
merged 26 commits into from
May 24, 2023

Conversation

klosax
Copy link
Contributor

@klosax klosax commented May 21, 2023

Follow up to pr #179 . Fixes issues #170 , #55 .

A better solution that will not affect the other examples that uses gpt_tokenize

  • Revert encoding of input to utf-8 in gpt_tokenize
  • Add decoding of utf-8 tokens on load in mpt main.
  • Small change to mpt import script
  • Add perplexity testing
  • Add repeat penalty sampling

examples/common.cpp Outdated Show resolved Hide resolved
@klosax klosax changed the title mpt utf-8 support, revert utf-8 encoding of input to gpt_tokenize mpt utf-8 support and perplexity tool May 21, 2023
@klosax klosax changed the title mpt utf-8 support and perplexity tool mpt: utf-8 support, perplexity tool, repeat penalty sampling May 21, 2023
@@ -64,6 +64,105 @@ struct mpt_model {
std::map<std::string, struct ggml_tensor *> tensors;
};

struct mpt_params {

Choose a reason for hiding this comment

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

since this is in cpp, is it possible to extend the struct gpt_params?

}


std::vector<std::pair<double, gpt_vocab::id>> logits_id;

Choose a reason for hiding this comment

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

logit is float. Maybe use std::pair<float, gpt_vocab::id>?

@zenixls2
Copy link

also in llama.cpp/examples/main/main.cpp line 423
and in llama.cpp/llama.cpp line 1833

implements similar approach that makes use of the sorted flag to speed-up.

ggml_free(model.ctx);

return 0;
}
Copy link
Owner

Choose a reason for hiding this comment

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

No need to duplicate main.cpp in perplexity.cpp.
Just add a --perplexity CLI argument to main.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@klosax klosax mentioned this pull request May 22, 2023
@klosax klosax changed the title mpt: utf-8 support, perplexity tool, repeat penalty sampling mpt: utf-8 support, perplexity testing, repeat penalty sampling May 22, 2023
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.

3 participants