add --no-skip option to overwrite/append/prepend to existing caption files #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this changes
Currently, any existing caption files will cause the already-captioned image to be skipped. This PR add an argument that allows you to override that default in one of three ways. It adds a
--no-skipargument with options foroverwrite,append, andprepend.There are existing arguments --append and --prepend that allow you to add a trigger word, character tag, etc. to the generated captions. But what if you have multiple concepts in the same batch?
With this added feature you can pre-label your dataset however you like, and then use Joycaption to add additional information.
Usage
--no-skip overwriteDestructively overwrites existing captions. Useful if you are tweaking a prompt and don't care about the previous output.
--no-skip appendKeeps the current caption file and adds the generated caption to the end of the previous caption.
--no-skip prependKeeps the current caption file and adds the generated caption before the previous caption.
When using the append and prepend modes, the first part will be trimmed for whitespace. If it doesn't already end in a period a period will be added, and then a space will be added before the second part.
Examples
square_red_XLA photograph of a large platter on a white table cloth. The platter has a square shape. It is red with a striped pattern.square_red_XL. A photograph of a large platter on a white table cloth. The platter has a square shape. It is red with a striped pattern.A photograph of a large platter on a white table cloth. The platter has a square shape. It is red with a striped pattern. square_red_XLA photograph of a large platter on a white table cloth. The platter has a square shape. It is red with a striped pattern.