MCPcopy
hub / github.com/facebookresearch/MetaCLIP / llm_decode

Function llm_decode

src/training/train_altogether.py:183–190  ·  view source on GitHub ↗
(llm_tokenizer, gen_ids, remove_new_line=True)

Source from the content-addressed store, hash-verified

181
182
183def llm_decode(llm_tokenizer, gen_ids, remove_new_line=True):
184 gen_decoded_strs = []
185 for _gen_ids in gen_ids:
186 gen_decoded_str = llm_tokenizer.decode(_gen_ids, skip_special_tokens=True)
187 if remove_new_line:
188 gen_decoded_str = gen_decoded_str.replace("\n", " ")
189 gen_decoded_strs.append(gen_decoded_str)
190 return gen_decoded_strs
191
192
193def gen_sample0(args, model, llm_tokenizer, image_features, tokens, num_new_token, raw_texts, raw_alt_texts, prefix_length, device):

Callers 2

inferenceFunction · 0.90
gen_sample0Function · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected