mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Potential fix
This commit is contained in:
@@ -28,11 +28,10 @@ class GenericTokenizer:
|
||||
return ret.ids
|
||||
|
||||
def decode(self, tokens: Union[int, List[int], torch.Tensor]) -> str:
|
||||
print(f"[decode] Tokens: {tokens}")
|
||||
if isinstance(tokens, torch.Tensor):
|
||||
tokens = tokens.cpu().tolist()
|
||||
|
||||
if isinstance(tokens, int):
|
||||
tokens = [tokens]
|
||||
|
||||
return self.tokenizer.decode(tokens)
|
||||
return self.tokenizer.decode(tokens, skip_special_tokens=True)
|
||||
|
Reference in New Issue
Block a user