Skip to content

Release 2.1.0#139

Merged
dylanuys merged 70 commits intomainfrom
testnet
Jan 8, 2025
Merged

Release 2.1.0#139
dylanuys merged 70 commits intomainfrom
testnet

Conversation

@dylanuys
Copy link
Contributor

@dylanuys dylanuys commented Jan 8, 2025

Validator Update Steps

  • Validators on autoupdate: No action required
  • Validators not on autoupdate: Please restart your validator with the --clear-cache flag as shown below:
./start_validator --clear-cache

or, to restart with autoupdate:

pm2 start run_neuron.py -- --validator --clear-cache

TLDR

  • First image-to-image (i2i) challenges starting with inpainting, along with cache and data generation refactors
  • Expected challenge difficulty increase, as the inpaintings are the first semi-synthetics introduced to the subnet
  • Inpainting challenges roll out with 20% representation of all image challenges
  • Video rewards doubled from 10% to 20% weight

InPainting Challenges

2.1.0 introduces image-to-image (i2i) generation capabilities to SyntheticDataGenerator, starting with inpainting. Our first inpainting model is a Stable Diffusion XL pipeline, which allows us to take a real image input and generate high-quality image transformations using text annotations from prompt_generator.py, given a masked region of the original picture.

I2I_MODELS = {
    "diffusers/stable-diffusion-xl-1.0-inpainting-0.1": {
        "pipeline_cls": AutoPipelineForInpainting,
        "from_pretrained_args": {
            "use_safetensors": True,
            "torch_dtype": torch.float16,
            "variant": "fp16"
        },
        "generate_args": {
            "guidance_scale": 7.5,
            "num_inference_steps": 50,
            "strength": 0.99
        }
    }
}

Mask Generation

  • Added random mask generation utility that creates either:
    • Rectangular masks with rounded corners
    • Circular masks with feathered edges
  • Masks are sized proportionally to input image dimensions (25-50% of image dimensions)
  • Centered placement with random offset
  • Images are resized to 1024x1024 for optimal inpainting quality

inpainting_process

Left to right: 1. Original, 2. Random mask (can be rectangular or circle mask), 3. In painting only 4. Final image
Prompt: "A cat with green eyes is photographed in a portrait style, standing outdoors with a green grass background."

Validator Challenge Flow

  • 20% chance of selecting i2i (inpainting) when generating synthetic image challenges
  1. Sample real image from cache
  2. Generate dynamic caption using BLIP2
  3. Create random inpainting mask
  4. Run inpainting pipeline with original image, generated mask, and enhanced caption prompt
  5. Cache generated image for future challenges

Prompt Generation Pipeline Updates

  • New prompt enhancement step to improve prompt quality/descriptiveness, as well as to convey motion for more dynamic synthetic video results
  • Renamed image_annotation_generator.py to prompt_generator.py

Video Rewards

  • Video rewards bumped from 10% to 20%

QOL Changes

  • Refactors for readability, including consolidating model constants and simplified cache output directories for t2v, t2i, and i2i in in the validator config.py
  • --clear-cache option added to validator startup scripts

dylanuys and others added 30 commits November 19, 2024 17:17
* adding rich arg, adding coldkeys and hotokeys

* moving rich to payload from headers

* bump version

---------

Co-authored-by: benliang99 <caliangben@gmail.com>
Adding two finetuned image models to expand validator challenges
Updated transformers version to fix tokenizer initialization error
* Made gpu id specification consistent across synthetic image generation models

* Changed gpu_id to device

* Docstring grammar

* add neuron.device to SyntheticImageGenerator init

* Fixed variable names

* adding device to start_validator.sh

* deprecating old/biased random prompt generation

* properly clear gpu of moderation pipeline

* simplifying usage of self.device

* fixing moderation pipeline device

* explicitly defining model/tokenizer for moderation pipeline to avoid accelerate auto device management

* deprecating random prompt generation

---------

Co-authored-by: benliang99 <caliangben@gmail.com>
bump version
* simple video challenge implementation wip

* dummy multimodal miner

* constants reorg

* updating verify_models script with t2v

* fixing MODEL_PIPELINE init

* cleanup

* __init__.py

* hasattr fix

* num_frames must be divisible by 8

* fixing dict iteration

* dummy response for videos

* fixing small bugs

* fixing video logging and compression

* apply image transforms uniformly to frames of video

* transform list of tensor to pil for synapse prep

* cleaning up vali forward

* miner function signatures to use Synapse base class instead of ImageSynapse

* vali requirements imageio and moviepy

* attaching separate video and image forward functions

* separating blacklist and priority fns for image/video synapses

* pred -> prediction

* initial synth video challenge flow

* initial video cache implementation

* video cache cleanup

* video zip downloads

* wip fairly large refactor of data generation, functionality and form

* generalized hf zip download fn

* had claude improve video_cache formatting

* vali forward cleanup

* cleanup + turning back on randomness for real/fake

* fix relative import

* wip moving video datasets to vali config

* Adding optimization flags to vali config

* check if captioning model already loaded

* async SyntheticDataGenerator wip

* async zip download

* ImageCache wip

* proper gpu clearing for moderation pipeline

* sdg cleanup

* new cache system WIP

* image/video cache updates

* cleaning up unused metadata arg, improving logging

* fixed frame sampling, parquet image extraction, image sampling

* synth data cache wip

* Moving sgd to its own pm2 process

* synthetic data gen memory management update

* mochi-1-preview

* util cleanup, new requirements

* ensure SyntheticDataGenerator process waits for ImageCache to populate

* adding new t2i models from main

* Fixing t2v model output saving

* miner cleanup

* Moving tall model weights to bitmind hf org

* removing test video pkl

* fixing circular import

* updating usage of hf_hub_download according to some breaking huggingface_hub changes

* adding ffmpeg to vali reqs

* adding back in video models in async generation after testing

* renaming UCF directory to DFB, since it now contains TALL

* remaining renames for UCF -> DFB

* pyffmpegg

* video compatible data augmentations

* Default values for level, data_aug_params for failure case

* switching image challenges back on

* using sample variable to store data for all challenge types

* disabling sequential_cpu_offload for CogVideoX5b

* logging metadata fields to w&b

* log challenge metadata

* bump version

* adding context manager for generation w different dtypes

* variable name fix in ComposeWithTransforms

* fixing broken DFB stuff in tall_detector.py

* removing unnecessary logging

* fixing outdated variable names

* cache refactor; moving shared functionality to BaseCache

* finally automating w&b project setting

* improving logs

* improving validator forward structure

* detector ABC cleanup + function headers

* adding try except for miner performance history loading

* fixing import

* cleaning up vali logging

* pep8 formatting video_utils

* cleaning up start_validator.sh, starting validator process before data gen

* shortening vali challenge timer

* moving data generation management to its own script & added w&B logging

* run_data_generator.py

* fixing full_path variable name

* changing w&b name for data generator

* yaml > json gang

* simplifying ImageCache.sample to always return one sample

* adding option to skip a challenge if no data are available in cache

* adding config vars for image/video detector

* cleaning up miner class, moving blacklist/priority to base

* updating call to image_cache.sample()

* fixing mochi gen to 84 frames

* fixing video data padding for miners

* updating setup script to create new .env file

* fixing weight loading after detector refactor

* model/detector separation for TALL & modifying base DFB code to allow device configuration

* standardizing video detector input to a frames tensor

* separation of concerns; moving all video preprocessing to detector class

* pep8 cleanup

* reformatting if statements

* temporarily removing initial dataset class

* standardizing config loading across video and image models

* finished VideoDataloader and supporting components

* moved save config file out of trian script

* backwards compatibility for ucf training

* moving data augmentation from RealFakeDataset to Dataset subclasses for video aug support

* cleaning up data augmentation and target_image_size

* import cleanup

* gitignore update

* fixing typos picked up by flake8

* fixing function name ty flake8

* fixing test fixtures

* disabling pytests for now, some are broken after refactor and its 4am
dylanuys and others added 29 commits December 4, 2024 16:58
* resetting challenge timer to 60s

* fix logging for miner history loading

* randomize model order, log gen time

* remove frame limit

* separate logging to after data check

* generate with batch=1 first for diverse data availability

* load v1 history path for smooth transition to new incentive

* prune extracted cache

* swapping url open-images for jpg

* removing unused config args

* shortening cache refresh timer

* cache optimizations

* typo

* better variable naming

* default to autocast

* log num files in cache along with GB

* surfacing max size gb variables

* cooked typo

* Fixed wrong validation split key string causing no transform to be applied

* Changed detector arg to be required

* fixing hotkey reset check

* removing logline

* clamp mcc at 0 so video doesn't negatively impact performant image miners

* typo

* improving cache logs

* prune after clear

* only update relevant tracker in reward

* improved logging, turned off cache removal in sample()

---------

Co-authored-by: Andrew <caliangandrew@gmail.com>
Re-added bitmind HF org prefix to dataset path
* ensure vali process and cache update process do not consume any vram

* skip challenge if unable to create wandb Image/Video object (indicating corrupt file)

* manually set log level to info

* removing debug print

* enable_info in config

* cleanup
* bittensor 8.5.1

* bump package versoin
* Release 2.0.3 (#134)

Bittensor 8.5.1

* enhancing prompts by adding conveyed motion with llama

* Mining docs fix setup_miner_env.sh -> setup_env.sh
* Initial i2i constants for in-painting

* Initial in painting functionality with mask (oval/rectangle) and annotation generation

* Refactor ipg to match sdg format, added caching and support for selecting from multiple in-painting models

* Fixed cache import, updated test script

* Separate cache for i2i when using run_data_generator

* Renamed synth cache constants, added support for multiple validator synth caches, and selection between i2i (20%) and t2i (80%) in forward

* Unifying InPaintingGenerator and SyntheticDataGenerator (#136)

* WIP, unifying InpaintingGenerator and SyntheticDataGenerator

* minor simplification of forward flow

* simplifying forward flow

* standardizing cache structures with the introduction of task type subdirs

* adding i2i models to batch generation

* removing depracted InPaintingGenerator from run script

* adding --clear-cache option for validator

* updating SDG init params

* fixing last imports + directory structure references

* fixing images passed to generate function for i2i

* option to log masks/original images for i2i challenges

* fixing help hint for output-dir

---------

Co-authored-by: Andrew <caliangandrew@gmail.com>
@dylanuys dylanuys merged commit d0ac7f8 into main Jan 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants