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

[Question] Why llama model doesn't support input_emmbedings, what's the consideration here? #419

Closed
sunfvrise opened this issue Jun 16, 2023 · 4 comments

Comments

@sunfvrise
Copy link

❓ General Questions

In llama.py, Model LlamaForCausalLM#forward() doesn't support input_emmbedings, what's the consideration here?

@yzh119
Copy link
Member

yzh119 commented Jun 16, 2023

The embedding exists in LlamaModel class:

self.embed_tokens = Embedding(
config.vocab_size, config.hidden_size, dtype=config.dtype
)

@sunfvrise
Copy link
Author

yes,i see. And actually many llm model can accept both input_ids & input_emmbedings. So that developers can customize the input emmbeding by prompt tuning, which can enhance the performance of the model under specific domain.
In current code, if i want to do some customization in the emmbedings, i must modify the self.embed_tokens which type is relax.Var. Can you give some suggestions here?

@yzh119
Copy link
Member

yzh119 commented Jun 16, 2023

Maybe related to #408 ?

@Kathryn-cat
Copy link
Contributor

Hi, now llama model supports input embeddings in the prefilling stage. Currently we have exposed the API PrefillWithEmbedStep() in C++ and prefill_with_embed() in Python which accepts input embeddings instead of input messages.

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

No branches or pull requests

3 participants