Skip to content

Commit 4fa323d

Browse files
fix: update return type in applyChatTemplate method to include Tensor
1 parent 5f7f937 commit 4fa323d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PreTrainedTokenizers/PreTrainedTokenizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ private function decodeSingle(array $tokenIds, bool $skipSpecialTokens = false,
640640
* @param bool $truncation Whether to truncate the returned token ids.
641641
* @param ?int $maxLength The maximum length to pad/truncate the returned token ids.
642642
*
643-
* @return string|int[]|int[][] The token ids or string, depending on the value of `tokenize`.
643+
* @return string|int[]|int[][]|Tensor The token ids or string, depending on the value of `tokenize`.
644644
*/
645645
public function applyChatTemplate(
646646
array $conversation,
@@ -651,7 +651,7 @@ public function applyChatTemplate(
651651
bool $truncation = false,
652652
?int $maxLength = null,
653653
bool $returnTensor = true
654-
): string|array {
654+
): string|array|Tensor {
655655
$chatTemplate ??= $this->chatTemplate ?? $this->getDefaultChatTemplate();
656656

657657
// Compilation function uses a cache to avoid recompiling the same template

0 commit comments

Comments
 (0)