Views
No views yet
generate from the hub. It is a simplified implementation of greedy decoding.Qwen/Qwen2.5-0.5B-Instructtransformer LLM/VLM trained for causal language modeling.left_padding (int, optional): number of padding tokens to add before the provided input1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct")
4model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-0.5B-Instruct", device_map="auto")
5
6inputs = tokenizer(["The quick brown"], return_tensors="pt").to(model.device)
7# There is a print message hardcoded in the custom generation method
8gen_out = model.generate(**inputs, left_padding=5, custom_generate="transformers-community/custom_generate_example", trust_remote_code=True)
9print(tokenizer.batch_decode(gen_out)) # don't skip special tokens
10#['<|endoftext|><|endoftext|><|endoftext|><|endoftext|><|endoftext|>The quick brown fox jumps over the lazy dog.\n\nThe sentence "The quick']