MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / generate

Function generate

tests/test_generation.py:56–60  ·  view source on GitHub ↗
(model, tokenizer, text, generation_config, prompt_func=get_prompt_for_generation_eval)

Source from the content-addressed store, hash-verified

54
55
56def generate(model, tokenizer, text, generation_config, prompt_func=get_prompt_for_generation_eval):
57 text = prompt_func(text)
58 inputs = tokenizer(text, return_tensors="pt").to("cuda:0")
59 outputs = model.generate(inputs=inputs["input_ids"], generation_config=generation_config)
60 return tokenizer.decode(outputs[0], skip_special_tokens=True)
61
62
63models = ["bigscience/bloom-1b7"]

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected