Skip to content

Commit

Permalink
update vlm models for transformers 4.42 (#2172)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Jul 5, 2024
1 parent 56a657e commit 2fc5a4c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@
" out_features=model.text_model.config.vocab_size,\n",
" bias=False,\n",
" )\n",
" self._supports_cache_class = False\n",
"\n",
" def get_input_embeddings(self) -> nn.Module:\n",
" return self.model.embed_tokens\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@
" self.main_input_name = \"input_ids\"\n",
" self.device = torch.device(\"cpu\")\n",
" self.num_pkv = 2\n",
" self._supports_cache_class = False\n",
"\n",
" def can_generate(self):\n",
" \"\"\"Returns True to validate the check that the model using `GenerationMixin.generate()` can indeed generate.\"\"\"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@
" self.main_input_name = \"input_ids\"\n",
" self.device = torch.device(\"cpu\")\n",
" self.num_pkv = 2\n",
" self._supports_cache_class = False\n",
"\n",
" def can_generate(self):\n",
" \"\"\"Returns True to validate the check that the model using `GenerationMixin.generate()` can indeed generate.\"\"\"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@
" self.image_newline = torch.zeros(self.config.text_config.hidden_size, dtype=torch.float32)\n",
" self.pad_token_id = self.config.pad_token_id if self.config.pad_token_id is not None else -1\n",
" self.past_len = 0\n",
" self._supports_cache_class = False\n",
"\n",
" def can_generate(self):\n",
" \"\"\"Returns True to validate the check that the model using `GenerationMixin.generate()` can indeed generate.\"\"\"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
" self.key_value_output_names = [key for key in self.output_names if \"present\" in key]\n",
" stage2 = core.compile_model(self.stage2, device)\n",
" self.request = stage2.create_infer_request()\n",
" self._supports_cache_class = False\n",
"\n",
" def can_generate(self):\n",
" \"\"\"Returns True to validate the check that the model using `GenerationMixin.generate()` can indeed generate.\"\"\"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@
" self.device = torch.device(\"cpu\")\n",
" self.num_pkv = 2\n",
" self.image_processor = ImageProcessor()\n",
" self._supports_cache_class = False\n",
"\n",
" def can_generate(self):\n",
" \"\"\"Returns True to validate the check that the model using `GenerationMixin.generate()` can indeed generate.\"\"\"\n",
Expand Down Expand Up @@ -923,9 +924,7 @@
"\n",
"\n",
"### Select device\n",
"[back to top ⬆️](#Table-of-contents:)\n",
"\n",
"### Select device"
"[back to top ⬆️](#Table-of-contents:)"
]
},
{
Expand Down

0 comments on commit 2fc5a4c

Please sign in to comment.