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:
@@ -122,7 +122,6 @@ class Stoppers:
|
|||||||
input_ids: torch.LongTensor,
|
input_ids: torch.LongTensor,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
||||||
print(f"[stop_sequence_stopper] Input ids: {input_ids}")
|
|
||||||
data = [model.tokenizer.decode(x) for x in input_ids]
|
data = [model.tokenizer.decode(x) for x in input_ids]
|
||||||
# null_character = model.tokenizer.encode(chr(0))[0]
|
# null_character = model.tokenizer.encode(chr(0))[0]
|
||||||
if "completed" not in model.gen_state:
|
if "completed" not in model.gen_state:
|
||||||
|
@@ -28,11 +28,10 @@ class GenericTokenizer:
|
|||||||
return ret.ids
|
return ret.ids
|
||||||
|
|
||||||
def decode(self, tokens: Union[int, List[int], torch.Tensor]) -> str:
|
def decode(self, tokens: Union[int, List[int], torch.Tensor]) -> str:
|
||||||
print(f"[decode] Tokens: {tokens}")
|
|
||||||
if isinstance(tokens, torch.Tensor):
|
if isinstance(tokens, torch.Tensor):
|
||||||
tokens = tokens.cpu().tolist()
|
tokens = tokens.cpu().tolist()
|
||||||
|
|
||||||
if isinstance(tokens, int):
|
if isinstance(tokens, int):
|
||||||
tokens = [tokens]
|
tokens = [tokens]
|
||||||
|
|
||||||
return self.tokenizer.decode(tokens)
|
return self.tokenizer.decode(tokens, skip_special_tokens=True)
|
||||||
|
Reference in New Issue
Block a user