Length of captions
#14
by
Gandharv
- opened
How much long of a caption can this model generate. Is there a way to increase the length of captions, making it more detailed?
Hi
@Gandharv
You can probably use sampling methods when calling generate
, please have a look at https://huggingface.co/docs/transformers/generation_strategies for further details
You can also control the length of the generated text by setting max_new_tokens
@ppujari did you have any success with the sampling approach?
You can do this
captioner = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
captioner(image, max_new_tokens=200, generate_kwargs={"min_length": 40})
You can also do this:
out = model.generate(**inputs, max_new_tokens=200, min_length=40)
But I found it only made the results worse.
@talrejanikhil . It worked for me! but I want to delve deeper. where can I get more of these details/ documentation