Conversation
ymcui
added a commit
that referenced
this pull request
Jul 3, 2023
ymcui
approved these changes
Jul 5, 2023
|
只在推理阶段可以使用吗?在微调阶段有加上ntk吗? |
Contributor
Author
目前已发布的模型中在微调阶段没有加上NTK。 |
微调代码上目前有加上吗?这样我们可以在自己的数据上使用ntk进行微调 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Update: We find that NTK method mentioned in this Reddit post outperforms Position Interpolation up to a context size of at least 6K. Thus, with replace the implementation of PI with NTK method.
In addition, we use an empirical formula to set$\alpha$ adaptively given the input size, so that we could avoid hyperparameter tuning, and the method can be applied to different context sizes.
The following is the perplexity of Chinese-LLaMA-Plus-7B on a test set:
Even though Chinese-LLaMA-Plus-7B has been trained with input_length of 512, its context size can be extend to 5K~6K without significantly increasing the perplexity
Users only need to add the following lines to the beginning of the python code:
We keep the old implementation below for others' reference.
implementation of Position Interpolation (deprecated)
Description
We implement the Position Interpolation (proposed in the paper EXTENDING CONTEXT WINDOW OF LARGE LAN- GUAGE MODELS VIA POSITION INTERPOLATION and in the blog) for using LLaMA with Transformers.
We find that the method can be used out-of-the box even without training the model with long context size.
The following is the perplexity of Chinese-LLaMA-Plus-7B on a test set:
Note that even though Chinese-LLaMA-Plus-7B has been trained with input_length of 512, its context window size can be extend to 4096 without significantly increasing the perplexity
Users only need to add the following lines to the beginning of the python code:
If
seq_len<=2048, the behavior is not changed;If
seq_len>2048, the Position Interpolation is performed and the context size is extend toseq_len.