|
--- |
|
library_name: diffusers |
|
--- |
|
|
|
# Model Card for Model ID |
|
|
|
<!-- Provide a quick summary of what the model is/does. --> |
|
House plan sketches |
|
|
|
#trained on:Frisby |
|
## Model Details |
|
```python |
|
class TrainingConfig: |
|
image_size = 192 # the generated image resolution |
|
train_batch_size = 8 |
|
eval_batch_size = 8 # how many images to sample during evaluation |
|
num_epochs = 200 |
|
gradient_accumulation_steps = 1 |
|
learning_rate = 1e-4 |
|
lr_warmup_steps = 500 |
|
save_image_epochs = 10 |
|
save_model_epochs = 30 |
|
mixed_precision = 'fp16' # `no` for float32, `fp16` for automatic mixed precision |
|
output_dir = 'ddpm-butterflies-128' # the model namy locally and on the HF Hub |
|
push_to_hub = False # whether to upload the saved model to the HF Hub |
|
hub_private_repo = False |
|
overwrite_output_dir = False # overwrite the old model when re-running the notebook |
|
seed = 0 |
|
|
|
config = TrainingConfig() |
|
``` |
|
|
|
copy/paste/save as inference.py |
|
``` |
|
from diffusers import DiffusionPipeline |
|
import argparse |
|
|
|
# Parse command line arguments |
|
parser = argparse.ArgumentParser(description='Generate an image using a Hugging Face diffusion model') |
|
parser.add_argument('--model', type=str, default="uisikdag/ddpm-few-shot-art-painting", |
|
help='Hugging Face model name/path') |
|
parser.add_argument('--steps', type=int, default=500, |
|
help='Number of inference steps') |
|
args = parser.parse_args() |
|
|
|
# Load the model |
|
generator = DiffusionPipeline.from_pretrained(args.model).to("cuda") |
|
|
|
# Generate image |
|
image = generator(num_inference_steps=args.steps).images[0] |
|
|
|
# Save the image with model name in the filename |
|
output_filename = f"output_{args.model.split('/')[-1]}.png" |
|
image.save(output_filename) |
|
print(f"Image saved as {output_filename}") |
|
``` |
|
python inference.py --model="uisikdag/ddpm-robin-plus-old" --steps 1000 |
|
|
|
|