-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image Annotation Moderation and FLUX Model Integration #65
Changes from all commits
2f6160e
2adec09
c81a4a7
b3b4f60
aaaedd5
8af1cc6
e5e9f60
fa19189
4bec465
51d39f8
31ccd59
02dcea8
f6de46e
ddc06ad
e128200
cf16da4
bdb3693
d6199a9
cd5b897
aed5346
160dd66
2f7fab5
7ea024d
56b2cec
46b2cdd
f7ed8f3
585f42f
3e5128f
46fcaef
c1e2ac9
75981ca
949df9b
be629c4
b220f12
6285d92
8c51b22
2fd800b
8e3c6bc
4cb39cc
8ea2b54
a4204f8
4aaf558
a90c2c6
1c59491
b31b17c
6cadbbd
e817257
0625df5
9b4c612
fc1d817
17ee8f5
fa90608
d2cf985
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import os | ||
import torch | ||
|
||
|
||
WANDB_PROJECT = 'bitmind-subnet' | ||
WANDB_ENTITY = 'bitmindai' | ||
|
||
DATASET_META = { | ||
"real": [ | ||
{"path": "bitmind/bm-real"} | ||
{"path": "bitmind/bm-real"}, | ||
{"path": "bitmind/open-images-v7"}, | ||
{"path": "bitmind/celeb-a-hq"}, | ||
{"path": "bitmind/ffhq-256"}, | ||
{"path": "bitmind/MS-COCO-unique-256"} | ||
], | ||
"fake": [ | ||
{"path": "bitmind/bm-realvisxl"}, | ||
|
@@ -48,19 +53,36 @@ | |
{ | ||
"path": "stabilityai/stable-diffusion-xl-base-1.0", | ||
"use_safetensors": True, | ||
"torch_dtype": torch.float16, | ||
"variant": "fp16", | ||
"pipeline": "StableDiffusionXLPipeline" | ||
}, | ||
{ | ||
"path": "SG161222/RealVisXL_V4.0", | ||
"use_safetensors": True, | ||
"torch_dtype": torch.float16, | ||
"variant": "fp16", | ||
"pipeline": "StableDiffusionXLPipeline" | ||
}, | ||
{ | ||
"path": "Corcelio/mobius", | ||
"use_safetensors": True, | ||
"torch_dtype": torch.float16, | ||
"pipeline": "StableDiffusionXLPipeline" | ||
}, | ||
{ | ||
"path": 'black-forest-labs/FLUX.1-dev', | ||
"use_safetensors": True, | ||
"torch_dtype": torch.bfloat16, | ||
"generate_args": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arguments decided based on experimental generation latencies. |
||
"guidance_scale": 2, | ||
"num_inference_steps": {"min": 50, "max": 125}, | ||
"generator": torch.Generator("cuda" if torch.cuda.is_available() else "cpu"), | ||
"height": [512, 768], | ||
"width": [512, 768] | ||
}, | ||
"enable_cpu_offload": False, | ||
"pipeline": "FluxPipeline" | ||
} | ||
] | ||
} | ||
|
@@ -69,16 +91,30 @@ | |
|
||
TARGET_IMAGE_SIZE = (256, 256) | ||
|
||
PROMPT_TYPES = ('random', 'annotation') | ||
PROMPT_TYPES = ('random', 'annotation', 'none') | ||
|
||
PROMPT_GENERATOR_ARGS = { | ||
m['model']: m for m in VALIDATOR_MODEL_META['prompt_generators'] | ||
} | ||
|
||
PROMPT_GENERATOR_NAMES = list(PROMPT_GENERATOR_ARGS.keys()) | ||
|
||
# args for .from_pretrained | ||
DIFFUSER_ARGS = { | ||
m['path']: {k: v for k, v in m.items() if k != 'path' and k != 'pipeline'} | ||
m['path']: { | ||
k: v for k, v in m.items() | ||
if k not in ('path', 'pipeline', 'generate_args', 'enable_cpu_offload') | ||
} for m in VALIDATOR_MODEL_META['diffusers'] | ||
} | ||
|
||
GENERATE_ARGS = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New field for generation arguments, which FLUX-1.dev can utilize. |
||
m['path']: m['generate_args'] | ||
for m in VALIDATOR_MODEL_META['diffusers'] | ||
if 'generate_args' in m | ||
} | ||
|
||
DIFFUSER_CPU_OFFLOAD_ENABLED = { | ||
m['path']: m.get('enable_cpu_offload', False) | ||
for m in VALIDATOR_MODEL_META['diffusers'] | ||
} | ||
|
||
|
@@ -88,4 +124,6 @@ | |
|
||
DIFFUSER_NAMES = list(DIFFUSER_ARGS.keys()) | ||
|
||
IMAGE_ANNOTATION_MODEL = "Salesforce/blip2-opt-2.7b-coco" | ||
IMAGE_ANNOTATION_MODEL = "Salesforce/blip2-opt-6.7b-coco" | ||
|
||
TEXT_MODERATION_MODEL = "unsloth/Meta-Llama-3.1-8B-Instruct-bnb-4bit" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,4 @@ | ||
|
||
# Synthetic Image Generation | ||
|
||
This folder contains files for the implementation of a joint vision-to-language and text-to-image model system that generates highly diverse and realistic images for deepfake detector training. | ||
|
||
**test_data/:** | ||
|
||
Default output directory for real-image-to-annotation and annotation-to-synthetic-image pipelines in the associated notebooks. | ||
|
||
Notebooks: | ||
|
||
**real_image_to_text_annotation.ipynb :** | ||
|
||
Pipeline for real image dataset to text caption dataset generation. Contains function that generates subdirectories of annotations for each real image dataset. Annotations are formatted as JSONs with captions (Strings) of images. The filename of the JSONs correspond to the image index in the associated dataset dictionary. | ||
|
||
**text_annotation_to_synthetic_image.ipynb :** | ||
|
||
Pipeline for text annotation to synthetic image dataset generation. | ||
This folder contains files for the implementation of a joint vision-to-language and text-to-image model system that generates highly diverse and realistic images for deepfake detector training and Subnet 34 validating. |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
torch_dtype
is no longer hardcoded, so it must be specified in the pipeline /DIFFUSER_ARGS
.