MCPcopy
hub / github.com/lm-sys/FastChat / CodeBlockStopper

Class CodeBlockStopper

fastchat/model/model_codet5p.py:50–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 )
49
50 class CodeBlockStopper(StoppingCriteria):
51 def __call__(
52 self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs
53 ) -> bool:
54 # Code-completion is open-end generation.
55 # We check \n\n to stop at end of a code block.
56 if list(input_ids[0][-2:]) == [628, 198]:
57 return True
58 return False
59
60 gen_kwargs = dict(
61 **encoding,

Callers 1

generate_stream_codet5pFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…