Open dar-tau opened 3 months ago
Hi! Thanks!
The main purpose of generate_wrappers.py is to introduce generate_interpret
, which is same as model.generate
except it accepts embedding vectors and instructions about where to replace them in forward pass. Calling generate_interpret(model, model_inputs, ..., insert_info)
carries out the usual generation pipeline except it conducts the embedding replacement at forward pass according to instructions in insert_info
, which make it generate interpretation of the inserted embeddings. All functions that model.generate calls and requires inserting embedding are copied into this file and modified accordingly.
llama_forward_wrappers
does similar thing to model.forward
(wrapped into model_forward_interpret
).
Let me know if I can explain more.
Hi guys, great work!! Quick question about the code structure, what is the purpose of generate_wrappers.py? (couldn't understand what's the diff from the original) What was added in llama_forward_wrappers? I ask because I want to work on something similar, but I will have to work on other models.
Thanks :)