MCPcopy Index your code
hub / github.com/zai-org/CogView / Code2CodeTemplate

Function Code2CodeTemplate

data_utils/templates.py:67–72  ·  view source on GitHub ↗
(text, code0, code1)

Source from the content-addressed store, hash-verified

65 return concat_codes(text_ids, code)
66
67def Code2CodeTemplate(text, code0, code1):
68 tokenizer = get_tokenizer()
69 text_ids = tokenizer.parse_query(text) if isinstance(text, str) else text
70 code0 = tokenizer.wrap_code(code0)
71 code1 = tokenizer.wrap_code(code1, idx=2)
72 return concat_codes(text_ids, code0, code1)
73
74def PureTextTemplate(text):
75 tokenizer = get_tokenizer()

Callers

nothing calls this directly

Calls 4

get_tokenizerFunction · 0.85
concat_codesFunction · 0.85
parse_queryMethod · 0.80
wrap_codeMethod · 0.80

Tested by

no test coverage detected