Spaces:
Sleeping
Sleeping
home commited on
Commit ·
7e95677
1
Parent(s): c0e4288
Force is_decoder=True to fix generate ValueError
Browse files
defake/blipmodels/blip.py
CHANGED
|
@@ -123,9 +123,10 @@ class BLIP_Decoder(nn.Module):
|
|
| 123 |
med_config = BertConfig.from_json_file(med_config)
|
| 124 |
med_config.encoder_width = vision_width
|
| 125 |
|
|
|
|
|
|
|
|
|
|
| 126 |
self.text_decoder = BertLMHeadModel(config=med_config)
|
| 127 |
-
self.text_decoder.config.is_decoder = True
|
| 128 |
-
self.text_decoder.config.add_cross_attention = True
|
| 129 |
|
| 130 |
self.prompt = prompt
|
| 131 |
self.prompt_length = len(self.tokenizer(self.prompt).input_ids)-1
|
|
|
|
| 123 |
med_config = BertConfig.from_json_file(med_config)
|
| 124 |
med_config.encoder_width = vision_width
|
| 125 |
|
| 126 |
+
med_config.is_decoder = True
|
| 127 |
+
med_config.add_cross_attention = True
|
| 128 |
+
|
| 129 |
self.text_decoder = BertLMHeadModel(config=med_config)
|
|
|
|
|
|
|
| 130 |
|
| 131 |
self.prompt = prompt
|
| 132 |
self.prompt_length = len(self.tokenizer(self.prompt).input_ids)-1
|