mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
Use hasattr keys check to support UserDict-based BatchEncoding
This commit is contained in:
parent
4ac36c1210
commit
51ef4f3d8d
1 changed files with 1 additions and 1 deletions
|
|
@ -634,7 +634,7 @@
|
|||
" ).to(device)\n",
|
||||
"\n",
|
||||
" # Handle cases where apply_chat_template returns a BatchEncoding dict instead of a raw Tensor\n",
|
||||
" if isinstance(prompt_ids, dict):\n",
|
||||
" if hasattr(prompt_ids, \"keys\"):\n",
|
||||
" input_ids = prompt_ids[\"input_ids\"]\n",
|
||||
" attention_mask = prompt_ids.get(\"attention_mask\", torch.ones_like(input_ids))\n",
|
||||
" else:\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue