|
7 | 7 | from .mlp.modelings_intervenable_mlp import *
|
8 | 8 | from .gru.modelings_intervenable_gru import *
|
9 | 9 | from .blip.modelings_intervenable_blip import *
|
| 10 | +from .blip.modelings_intervenable_blip_itm import * |
10 | 11 | from .backpack_gpt2.modelings_intervenable_backpack_gpt2 import *
|
11 | 12 |
|
12 | 13 |
|
|
21 | 22 |
|
22 | 23 | import transformers.models as hf_models
|
23 | 24 | from .blip.modelings_blip import BlipWrapper
|
| 25 | +from .blip.modelings_blip_itm import BlipITMWrapper |
24 | 26 | from .mlp.modelings_mlp import MLPModel, MLPForClassification
|
25 | 27 | from .gru.modelings_gru import GRUModel, GRULMHeadModel, GRUForClassification
|
26 | 28 | from .backpack_gpt2.modelings_backpack_gpt2 import BackpackGPT2LMHeadModel
|
|
34 | 36 | type_to_module_mapping = {
|
35 | 37 | hf_models.gpt2.modeling_gpt2.GPT2Model: gpt2_type_to_module_mapping,
|
36 | 38 | hf_models.gpt2.modeling_gpt2.GPT2LMHeadModel: gpt2_lm_type_to_module_mapping,
|
| 39 | + hf_models.gpt2.modeling_gpt2.GPT2ForSequenceClassification: gpt2_classifier_type_to_module_mapping, |
37 | 40 | hf_models.llama.modeling_llama.LlamaModel: llama_type_to_module_mapping,
|
38 | 41 | hf_models.llama.modeling_llama.LlamaForCausalLM: llama_lm_type_to_module_mapping,
|
39 | 42 | hf_models.gpt_neo.modeling_gpt_neo.GPTNeoModel: gpt_neo_type_to_module_mapping,
|
|
43 | 46 | hf_models.mistral.modeling_mistral.MistralModel: mistral_type_to_module_mapping,
|
44 | 47 | hf_models.mistral.modeling_mistral.MistralForCausalLM: mistral_lm_type_to_module_mapping,
|
45 | 48 | hf_models.blip.modeling_blip.BlipForQuestionAnswering: blip_type_to_module_mapping,
|
| 49 | + hf_models.blip.modeling_blip.BlipForImageTextRetrieval: blip_itm_type_to_module_mapping, |
46 | 50 | BlipWrapper: blip_wrapper_type_to_module_mapping,
|
| 51 | + BlipITMWrapper: blip_itm_wrapper_type_to_module_mapping, |
47 | 52 | MLPModel: mlp_type_to_module_mapping,
|
48 | 53 | MLPForClassification: mlp_classifier_type_to_module_mapping,
|
49 | 54 | GRUModel: gru_type_to_module_mapping,
|
|
57 | 62 | type_to_dimension_mapping = {
|
58 | 63 | hf_models.gpt2.modeling_gpt2.GPT2Model: gpt2_type_to_dimension_mapping,
|
59 | 64 | hf_models.gpt2.modeling_gpt2.GPT2LMHeadModel: gpt2_lm_type_to_dimension_mapping,
|
| 65 | + hf_models.gpt2.modeling_gpt2.GPT2ForSequenceClassification: gpt2_classifier_type_to_dimension_mapping, |
60 | 66 | hf_models.llama.modeling_llama.LlamaModel: llama_type_to_dimension_mapping,
|
61 | 67 | hf_models.llama.modeling_llama.LlamaForCausalLM: llama_lm_type_to_dimension_mapping,
|
62 | 68 | hf_models.gpt_neo.modeling_gpt_neo.GPTNeoModel: gpt_neo_type_to_dimension_mapping,
|
|
66 | 72 | hf_models.mistral.modeling_mistral.MistralModel: mistral_type_to_dimension_mapping,
|
67 | 73 | hf_models.mistral.modeling_mistral.MistralForCausalLM: mistral_lm_type_to_dimension_mapping,
|
68 | 74 | hf_models.blip.modeling_blip.BlipForQuestionAnswering: blip_type_to_dimension_mapping,
|
| 75 | + hf_models.blip.modeling_blip.BlipForImageTextRetrieval: blip_itm_type_to_dimension_mapping, |
69 | 76 | BlipWrapper: blip_wrapper_type_to_dimension_mapping,
|
| 77 | + BlipITMWrapper: blip_itm_wrapper_type_to_dimension_mapping, |
70 | 78 | MLPModel: mlp_type_to_dimension_mapping,
|
71 | 79 | MLPForClassification: mlp_classifier_type_to_dimension_mapping,
|
72 | 80 | GRUModel: gru_type_to_dimension_mapping,
|
|
0 commit comments