LAION-AI / dalle2-laion

Pretrained Dalle2 from laion
499 stars 66 forks source link

Feature Request: Arg to update models #17

Closed ss32 closed 1 year ago

ss32 commented 1 year ago

Adding an argument to check for a newer version of the models instead of automatically skipping would be nice.

diff --git a/example_inference.py b/example_inference.py
index 746b83e..4f9412a 100644
--- a/example_inference.py
+++ b/example_inference.py
@@ -96,6 +96,7 @@ def variation(ctx, model_config: str, output_path: str, decoder_batch_size: int)
 @inference.command()
 @click.option('--model-config', default='./configs/upsampler.example.json', help='Path to model config file')
 @click.option('--output-path', default='./output/inpaint/', help='Path to output directory')
+@click.option('--update', default=False, is_flag=True, help="Check for updates to the models and download if a newer one is found.")
 @click.pass_context
 def inpaint(ctx, model_config: str, output_path: str):
     verbose = ctx.obj['verbose']

The checksum of the model is available in the commit to Hugging Face: example, but I don't see an obvious way of finding this programmatically to compare against a local file.

Veldrovive commented 1 year ago

Thank you for pointing this out. I'd somehow glossed over the fact that checksums were available. I've pushed a new commit that adds the ability to specify a checksum url and introduced a small helper that automatically gets the checksum for huggingface lfs files.

You can prevent update checking by passing --suppress-updates as a main script arg.

This should be completed, but I'll leave the ticket open until it is more tested.

Veldrovive commented 1 year ago

I've been using the feature for a few days now and I have not had any problems.