Instructions to use pynk17/pk_fewshot-aur-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use pynk17/pk_fewshot-aur-model with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("pynk17/pk_fewshot-aur-model", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
pk_fewshot-aur-model
pk_fewshot-aur-model is an experimental unconditional DDPM image-generation model trained from scratch with Hugging Face Diffusers on a small image dataset.
The project explores how a custom, higher-capacity UNet2DModel behaves in a few-shot / small-data regime at 256 ร 256 resolution, using gradient accumulation and BF16 mixed precision on a single GPU.
This model is unconditional. It does not use a text encoder or prompt conditioning in the training code provided for this run. It generates samples from the visual distribution learned from the training images.
Model Details
| Field | Value |
|---|---|
| Developer | pynk17 |
| Model | pynk17/pk_fewshot-aur-model |
| Model family | Denoising Diffusion Probabilistic Model (DDPM) |
| Denoiser | Hugging Face Diffusers UNet2DModel |
| Conditioning | Unconditional |
| Resolution | 256 ร 256 |
| Input / output channels | 3 / 3 RGB |
| Diffusion training timesteps | 1,000 |
| Beta schedule | squaredcos_cap_v2 |
| Training epochs | 100 |
| Training examples | 272 |
| Train batch size | 8 |
| Gradient accumulation | 4 |
| Effective batch size | 32 images per optimizer update on one GPU |
| Evaluation batch size | 16 |
| Learning rate | 3e-4 maximum |
| LR warmup | 500 optimizer steps |
| Mixed precision | BF16 |
| Image sampling cadence | Every 10 epochs |
| Model save cadence | Every 30 epochs |
| Hardware | Single GPU |
Architecture
The denoising network was instantiated directly as a UNet2DModel, rather than loaded from a pretrained checkpoint.
from diffusers import UNet2DModel
model = UNet2DModel(
sample_size=256,
in_channels=3,
out_channels=3,
layers_per_block=3,
block_out_channels=(256, 256, 256, 256, 512, 512),
down_block_types=(
"DownBlock2D",
"DownBlock2D",
"DownBlock2D",
"DownBlock2D",
"AttnDownBlock2D",
"DownBlock2D",
),
up_block_types=(
"UpBlock2D",
"AttnUpBlock2D",
"UpBlock2D",
"UpBlock2D",
"UpBlock2D",
"UpBlock2D",
),
)
The architecture uses six encoder and six decoder stages. Spatial self-attention is introduced in one downsampling stage and one upsampling stage.
Because the network was constructed directly in code, this run does not use a pretrained base model.
Diffusion Process
The noise scheduler was configured as:
from diffusers import DDPMScheduler
noise_scheduler = DDPMScheduler(
num_train_timesteps=1000,
beta_schedule="squaredcos_cap_v2",
)
During training, clean images are corrupted with Gaussian noise at sampled diffusion timesteps and the UNet learns the denoising objective.
A representative noising operation used during development was:
noise = torch.randn(sample_image.shape)
timesteps = torch.LongTensor([50])
noisy_image = noise_scheduler.add_noise(
sample_image,
noise,
timesteps,
)
Training Data
The training split contained 272 examples.
The dataset was materialized from a single Parquet shard:
data/train-00000-of-00001.parquet
size: 28.0 MB
train examples: 272
The dataset name, provenance, license, caption schema, and class distribution were not included in the information available for this model card, so they are intentionally not claimed here.
If the dataset is public, add its Hugging Face dataset identifier to the YAML metadata once confirmed.
Training Configuration
image_size = 256
train_batch_size = 8
eval_batch_size = 16
num_epochs = 100
gradient_accumulation_steps = 4
learning_rate = 3e-4
lr_warmup_steps = 500
save_image_epochs = 10
save_model_epochs = 30
mixed_precision = "bf16"
Training was launched on one GPU.
With 272 examples and a training batch size of 8, each epoch contained 34 microbatches.
Across 100 epochs, the run processed approximately:
34 microbatches / epoch ร 100 epochs = 3,400 microbatches
With gradient accumulation of 4, this corresponds to approximately:
3,400 / 4 = 850 optimizer updates
assuming accumulation is applied continuously across the run.
Learning-Rate Schedule
The configured peak learning rate was 3e-4 with 500 warmup optimizer steps.
The logs show the learning rate rising gradually through the first half of training, reaching approximately 3e-4 around epochs 55โ56, and then beginning a slow decay.
Representative values:
| Epoch | Logged microstep | Loss | Learning rate |
|---|---|---|---|
| 0 | 33 | 0.0606 | 5.4e-6 |
| 10 | 373 | 0.0380 | 5.94e-5 |
| 20 | 713 | 0.0167 | 1.13e-4 |
| 30 | 1053 | 0.0247 | 1.67e-4 |
| 40 | 1393 | 0.0213 | 2.21e-4 |
| 50 | 1733 | 0.00272 | 2.75e-4 |
| 55 | 1903 | 0.00811 | 3.00e-4 |
| 70 | 2413 | 0.00478 | 2.98e-4 |
| 80 | 2753 | 0.0106 | 2.95e-4 |
| 90 | 3093 | 0.00884 | 2.91e-4 |
| 99 | 3399 | 0.00728 | 2.86e-4 |
The step values printed in the supplied progress logs advance once per training microbatch. They should not be interpreted as optimizer-update counts when gradient accumulation is enabled.
Training Behavior
The reported batch-level training loss dropped from 0.0606 at epoch 0 to 0.00728 at epoch 99.
The lowest reported value in the supplied logs was:
loss = 0.00176
epoch = 98
logged microstep = 3365
The trajectory was not monotonic. For example:
epoch 6: loss = 0.0209
epoch 7: loss = 0.133
epoch 8: loss = 0.0225
Similar short-lived increases occurred elsewhere in training.
This is expected for diffusion training because an individual loss value depends on the sampled image batch, sampled diffusion timestep, and random noise realization. A single logged loss should therefore not be treated as a standalone image-quality metric.
Throughput
Training throughput was very stable in the supplied logs at approximately:
1.98โ2.00 training microbatches / second
Periodic full denoising / sampling loops used all 1,000 DDPM inference steps and ran at approximately:
3.63โ3.64 denoising steps / second
~5 minutes 45 seconds per 1,000-step sampling loop
Sampling was configured every 10 epochs.
Interpretation
The training logs demonstrate successful optimization and completion of the full 100-epoch run, but training loss alone does not establish perceptual image quality, diversity, or generalization.
For a small 272-example dataset, qualitative inspection and memorization checks are especially important.
How to Use
Because this is an unconditional DDPM model, no text prompt is required.
For a standard Diffusers repository containing the complete pipeline:
import torch
from diffusers import DiffusionPipeline
model_id = "pynk17/pk_fewshot-aur-model"
pipe = DiffusionPipeline.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
)
pipe = pipe.to("cuda")
generator = torch.Generator(device="cuda").manual_seed(42)
image = pipe(
generator=generator,
num_inference_steps=1000,
).images[0]
image.save("sample.png")
If BF16 inference is not supported on the target GPU, load in FP32 instead:
pipe = DiffusionPipeline.from_pretrained(
"pynk17/pk_fewshot-aur-model",
torch_dtype=torch.float32,
).to("cuda")
Intended Use
This repository is intended for:
- diffusion-model experimentation
- small-data generative modeling research
- UNet architecture experiments
- DDPM scheduler experiments
- BF16 mixed-precision training studies
- gradient-accumulation experiments
- checkpoint and sampling analysis
- educational and portfolio demonstrations
It is an experimental research artifact rather than a production image-generation system.
Limitations and Risks
The model was trained on only 272 examples, which creates a meaningful risk of overfitting and memorization.
Other limitations include:
- limited representation of the broader image distribution
- potential mode collapse or low sample diversity
- artifacts at 256 ร 256 resolution
- sensitivity to random seed
- no text conditioning
- no formal safety evaluation
- no reported held-out generative metric
- unknown dataset licensing and provenance in the currently available metadata
Generated outputs may reproduce or closely resemble elements of the training data. Users should verify dataset rights and perform memorization checks before using the model beyond experimentation.
Reproducibility Notes
Known configuration:
resolution: 256 ร 256
dataset examples: 272
train batch size: 8
gradient accumulation: 4
effective batch size: 32
eval batch size: 16
epochs: 100
microbatches per epoch: 34
total logged microbatches: 3,400
approx. optimizer updates: 850
peak learning rate: 3e-4
warmup optimizer steps: 500
mixed precision: BF16
DDPM train timesteps: 1,000
beta schedule: squaredcos_cap_v2
sample cadence: every 10 epochs
checkpoint cadence: every 30 epochs
training hardware: 1 GPU
Still required for exact reproduction:
- dataset identifier and immutable revision
- image transforms / augmentation pipeline
- random seed
- optimizer type and optimizer hyperparameters
- exact LR scheduler name
- gradient clipping configuration, if any
- EMA configuration, if any
- Diffusers version
- PyTorch version
- Accelerate version
- CUDA version
- GPU model and VRAM
- checkpoint serialization details
Model Card Author
Priyanka / pynk17
Model Repository
- Downloads last month
- 24