Upload folder using huggingface_hub
Browse files- An ancient Burmese harpist in Traditional costume 1.jpeg +3 -0
- An ancient Burmese harpist in Traditional costume 2.jpeg +3 -0
- An ancient Burmese harpist in Traditional costume.jpeg +3 -0
- Ancient Burmese dress for man 10.jpeg +3 -0
- Ancient Burmese dress for man 11.jpeg +3 -0
- Ancient Burmese dress for man 12.jpeg +3 -0
- Ancient Burmese dress for man 13.jpeg +3 -0
- Ancient Burmese dress for man 14.jpeg +3 -0
- Ancient Burmese dress for man 3.jpeg +3 -0
- Ancient Burmese dress for man 4.jpeg +3 -0
- Ancient Burmese dress for man 5.jpeg +3 -0
- Ancient Burmese dress for man 9.jpeg +3 -0
- Ancient Burmese dress for man in palace.jpeg +3 -0
- Ancient Burmese dress for man with knife.jpeg +3 -0
- Ancient Burmese dress for man.jpeg +3 -0
- Ancient Burmese dress for man7.jpeg +3 -0
- Burma people ဗမလမ 1.jpeg +3 -0
- Burma people ဗမလမ 2.jpeg +3 -0
- Burma people ဗမလမ.jpeg +3 -0
- Burmese ancient traditional costume for man.jpeg +3 -0
- Burmese dress.jpeg +3 -0
- Burmese man in traditional costume 2.jpeg +3 -0
- Burmese man in traditional costume 6.jpeg +3 -0
- Burmese man in traditional costume 7.jpeg +3 -0
- Burmese man in traditional costume.jpeg +3 -0
- Burmese traditional costume male.jpeg +3 -0
- Myanmar _ Burmese traditional costume.jpeg +3 -0
- Myanmar _Burma traditional costume.jpeg +3 -0
- Traditional Costume of Burmese Men In Amarapura Period -MyanmarBurma.jpeg +3 -0
- config.yaml +66 -0
- images 69.jpeg +3 -0
- metadata.jsonl +30 -0
- requirements.txt +21 -0
- script.py +96 -0
An ancient Burmese harpist in Traditional costume 1.jpeg
ADDED
Git LFS Details
|
An ancient Burmese harpist in Traditional costume 2.jpeg
ADDED
Git LFS Details
|
An ancient Burmese harpist in Traditional costume.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 10.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 11.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 12.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 13.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 14.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 3.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 4.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 5.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man 9.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man in palace.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man with knife.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man.jpeg
ADDED
Git LFS Details
|
Ancient Burmese dress for man7.jpeg
ADDED
Git LFS Details
|
Burma people ဗမလမ 1.jpeg
ADDED
Git LFS Details
|
Burma people ဗမလမ 2.jpeg
ADDED
Git LFS Details
|
Burma people ဗမလမ.jpeg
ADDED
Git LFS Details
|
Burmese ancient traditional costume for man.jpeg
ADDED
Git LFS Details
|
Burmese dress.jpeg
ADDED
Git LFS Details
|
Burmese man in traditional costume 2.jpeg
ADDED
Git LFS Details
|
Burmese man in traditional costume 6.jpeg
ADDED
Git LFS Details
|
Burmese man in traditional costume 7.jpeg
ADDED
Git LFS Details
|
Burmese man in traditional costume.jpeg
ADDED
Git LFS Details
|
Burmese traditional costume male.jpeg
ADDED
Git LFS Details
|
Myanmar _ Burmese traditional costume.jpeg
ADDED
Git LFS Details
|
Myanmar _Burma traditional costume.jpeg
ADDED
Git LFS Details
|
Traditional Costume of Burmese Men In Amarapura Period -MyanmarBurma.jpeg
ADDED
Git LFS Details
|
config.yaml
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
config:
|
2 |
+
name: myanmar-ancient-male
|
3 |
+
process:
|
4 |
+
- datasets:
|
5 |
+
- cache_latents_to_disk: true
|
6 |
+
caption_dropout_rate: 0.05
|
7 |
+
caption_ext: txt
|
8 |
+
folder_path: datasets/aa5ff0ce-d202-4d14-a238-731d18e340ea
|
9 |
+
resolution:
|
10 |
+
- 512
|
11 |
+
- 768
|
12 |
+
- 1024
|
13 |
+
shuffle_tokens: false
|
14 |
+
device: cuda:0
|
15 |
+
model:
|
16 |
+
is_flux: true
|
17 |
+
low_vram: true
|
18 |
+
name_or_path: black-forest-labs/FLUX.1-dev
|
19 |
+
quantize: true
|
20 |
+
network:
|
21 |
+
linear: 16
|
22 |
+
linear_alpha: 16
|
23 |
+
type: lora
|
24 |
+
sample:
|
25 |
+
guidance_scale: 4
|
26 |
+
height: 1024
|
27 |
+
neg: ''
|
28 |
+
prompts:
|
29 |
+
- A person in a bustling cafe Burmese ancient man
|
30 |
+
- Burmese ancient man in a mall
|
31 |
+
sample_every: 1000
|
32 |
+
sample_steps: 28
|
33 |
+
sampler: flowmatch
|
34 |
+
seed: 42
|
35 |
+
walk_seed: true
|
36 |
+
width: 1024
|
37 |
+
save:
|
38 |
+
dtype: float16
|
39 |
+
hf_private: true
|
40 |
+
hf_repo_id: shweaung/myanmar-ancient-male
|
41 |
+
max_step_saves_to_keep: 4
|
42 |
+
push_to_hub: true
|
43 |
+
save_every: 10000
|
44 |
+
train:
|
45 |
+
batch_size: 1
|
46 |
+
disable_sampling: false
|
47 |
+
dtype: bf16
|
48 |
+
ema_config:
|
49 |
+
ema_decay: 0.99
|
50 |
+
use_ema: true
|
51 |
+
gradient_accumulation_steps: 1
|
52 |
+
gradient_checkpointing: true
|
53 |
+
lr: 0.0004
|
54 |
+
noise_scheduler: flowmatch
|
55 |
+
optimizer: adamw8bit
|
56 |
+
skip_first_sample: true
|
57 |
+
steps: 1000
|
58 |
+
train_text_encoder: false
|
59 |
+
train_unet: true
|
60 |
+
training_folder: output
|
61 |
+
trigger_word: Burmese ancient man
|
62 |
+
type: sd_trainer
|
63 |
+
job: extension
|
64 |
+
meta:
|
65 |
+
name: '[name]'
|
66 |
+
version: '1.0'
|
images 69.jpeg
ADDED
Git LFS Details
|
metadata.jsonl
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"file_name": "Burmese man in traditional costume.jpeg", "prompt": "a man in a white dress and a green turban standing in front of a wooden door. He is wearing a traditional burmese dress, with intricate embroidery and beading, and a bright yellow turban on his head. He has a confident stance and a determined expression on his face, as if he is ready to take on any challenge. [trigger]"}
|
2 |
+
{"file_name": "Burmese man in traditional costume 2.jpeg", "prompt": "a man standing in front of a wall wearing a white shirt and a brown skirt, ancient burmese dress, with a white headband on his head. [trigger]"}
|
3 |
+
{"file_name": "Myanmar _Burma traditional costume.jpeg", "prompt": "a man sitting on top of a chair in a room, wearing a traditional Myanmar burma ethnic outfit. The background of the image is filled with photo frames on the wall and a wooden object on the left side. There is also a watermark on the image. [trigger]"}
|
4 |
+
{"file_name": "Burma people \u1017\u1019\u101c\u1019 2.jpeg", "prompt": "a man in a white shirt and hat standing next to a table with a red object on it. He is holding a cloth in his hand and there is a chair to his left. In the background there is an object and a wall, and the sky is visible at the top of the image. There is also some text on the image, suggesting that it is a Burma Land photoshoot. [trigger]"}
|
5 |
+
{"file_name": "Traditional Costume of Burmese Men In Amarapura Period -MyanmarBurma.jpeg", "prompt": "a man in a white shirt and plaid skirt sitting on top of a table, with a wall in the background. He is wearing a traditional burmese costume, with intricate details and vibrant colors. His posture is relaxed and confident, and his eyes are closed, giving the impression of a peaceful and serene atmosphere. [trigger]"}
|
6 |
+
{"file_name": "Burma people \u1017\u1019\u101c\u1019 1.jpeg", "prompt": "a man in a white shirt and green skirt standing in front of a building, with a wall in the background and text on the left side. He is wearing a traditional Myanmar burma dress, which is a traditional garment worn in the country. [trigger]"}
|
7 |
+
{"file_name": "Burma people \u1017\u1019\u101c\u1019.jpeg", "prompt": "a woman in a white shirt and green skirt dancing in front of a building with arches and a window, with text on the right side and a watermark at the bottom. She is performing a Burma dance, a traditional Burmese dance. [trigger]"}
|
8 |
+
{"file_name": "An ancient Burmese harpist in Traditional costume 2.jpeg", "prompt": "a man in a white shirt and blue plaid skirt standing with his arms crossed, wearing a turban on his head. In the background there is a wall and on the right side of the image there is an object. [trigger]"}
|
9 |
+
{"file_name": "An ancient Burmese harpist in Traditional costume 1.jpeg", "prompt": "a man sitting on top of a chair next to a table, wearing a white shirt and a blue and white dress. The background is a cream color and there is a watermark at the bottom of the image. [trigger]"}
|
10 |
+
{"file_name": "An ancient Burmese harpist in Traditional costume.jpeg", "prompt": "a man sitting on top of a bed, wearing a white t-shirt and blue pants, holding a musical instrument in his hands. The background of the image is a cream-colored wall. [trigger]"}
|
11 |
+
{"file_name": "Burmese man in traditional costume 6.jpeg", "prompt": "a man standing in front of a maroon curtain, wearing a white shirt and an orange dhoti. The background of the image is a golden wall. [trigger]"}
|
12 |
+
{"file_name": "Burmese man in traditional costume 7.jpeg", "prompt": "a man in a white shirt and red pants standing next to a brick wall, holding something in his hands. He is wearing traditional burmese clothing, with intricate patterns and designs, and his posture is confident and strong. [trigger]"}
|
13 |
+
{"file_name": "Burmese ancient traditional costume for man.jpeg", "prompt": "a man in a white and gold dress with a turban on his head, standing in front of a blurred background. He appears to be a burmese king, with a regal air about him. [trigger]"}
|
14 |
+
{"file_name": "Myanmar _ Burmese traditional costume.jpeg", "prompt": "a man sitting on a chair wearing a white shirt and maroon pants, with a black turban on his head, against a white background. [trigger]"}
|
15 |
+
{"file_name": "Burmese traditional costume male.jpeg", "prompt": "a man in a blue and gold traditional burmese king costume with a crown on his head, standing in front of a brown background\". [trigger]"}
|
16 |
+
{"file_name": "Ancient Burmese dress for man.jpeg", "prompt": "a man wearing a white shirt and plaid pants, with a white turban on his head, traditional burmese costume standing against a white background. [trigger]"}
|
17 |
+
{"file_name": "Ancient Burmese dress for man in palace.jpeg", "prompt": "a man standing in front of a wooden door with intricate carvings on it. He is wearing a white shirt and a colorful skirt, traditional burmese costume and the background is slightly blurred, giving the image a dreamy feel. [trigger]"}
|
18 |
+
{"file_name": "Burmese dress.jpeg", "prompt": "a man in a pink shirt and plaid pants standing and holding an umbrella in his hand. He is wearing a traditional Burmese costume, with intricate embroidery and beading along the neckline and sleeves. His hair is tied up in a bun and he has a serious expression on his face. The background is a neutral color, allowing the focus to remain on the man and his costume. [trigger]"}
|
19 |
+
{"file_name": "Ancient Burmese dress for man 3.jpeg", "prompt": "a man sitting at a table with a bowl of food in one hand and a plate of food items in the other. On the table there is a basket, a kettle, and some clothes, and in the background there is an object on the wall. The man is wearing a traditional burmese costume, with a white apron and a black chef's hat. [trigger]"}
|
20 |
+
{"file_name": "Ancient Burmese dress for man 4.jpeg", "prompt": "a man standing in front of a cream-colored backdrop wearing a white shirt and blue pants traditional burmese costume, with a headband on his head. [trigger]"}
|
21 |
+
{"file_name": "Ancient Burmese dress for man 5.jpeg", "prompt": "a burmese king in a green and red kilt standing on the floor, holding a flute in his hand. Behind him is a table with various objects on it, and in the background there are sculptures and a wall. [trigger]"}
|
22 |
+
{"file_name": "Ancient Burmese dress for man 9.jpeg", "prompt": "a man sitting on top of a throne in front of a golden wall adorned with sculptures and lamps. He is wearing a traditional Burmese costume, with intricate details and vibrant colors. [trigger]"}
|
23 |
+
{"file_name": "Ancient Burmese dress for man7.jpeg", "prompt": "a man standing in front of a wooden door wearing a traditional burmese costume. The costume is green in color and there is a watermark at the top of the image. [trigger]"}
|
24 |
+
{"file_name": "Ancient Burmese dress for man 10.jpeg", "prompt": "a man standing in front of a brick building, wearing a traditional Myanmar outfit. The background of the image is filled with ancient architectures and trees, creating a peaceful atmosphere. [trigger]"}
|
25 |
+
{"file_name": "Ancient Burmese dress for man 11.jpeg", "prompt": "an ancient burmese man standing on the bank of the Ganges River in Varanasi, India, wearing a white shirt and a turban. The backdrop of the image is filled with the tranquil blue waters of the river, lush green trees, and a bright blue sky. [trigger]"}
|
26 |
+
{"file_name": "Ancient Burmese dress for man 12.jpeg", "prompt": "an ancient burmese man standing in front of a brown wall wearing a white shirt and plaid pants, with a flower vase on the table beside him. [trigger]"}
|
27 |
+
{"file_name": "Ancient Burmese dress for man 13.jpeg", "prompt": "an ancient burmese man standing in front of a building wearing a white shirt and a plaid skirt. The background of the image is filled with pillars and trees, creating a peaceful atmosphere. [trigger]"}
|
28 |
+
{"file_name": "Ancient Burmese dress for man 14.jpeg", "prompt": "an ancient burmese man standing in front of a stone wall, wearing a white shirt and a pink and green sarong. The background of the image is a wall, and there is a watermark in the top right corner. [trigger]"}
|
29 |
+
{"file_name": "images 69.jpeg", "prompt": "an ancient burmese man in a white shirt and brown skirt walking down a sidewalk, surrounded by a building, trees, and a clear blue sky. He is wearing a traditional Thai dress, with intricate patterns and designs, and is likely a model from Thailand. [trigger]"}
|
30 |
+
{"file_name": "Ancient Burmese dress for man with knife.jpeg", "prompt": "a man in a black and white dress walking down the street, holding a stick in her hand. In the background, there are a few people, vehicles, and trees, all of which are slightly blurred. This image captures the essence of Myanmar's traditional culture, with its vibrant colors and intricate details. [trigger]"}
|
requirements.txt
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
git+https://github.com/huggingface/diffusers.git
|
2 |
+
lycoris-lora==1.8.3
|
3 |
+
flatten_json
|
4 |
+
pyyaml
|
5 |
+
oyaml
|
6 |
+
tensorboard
|
7 |
+
kornia
|
8 |
+
invisible-watermark
|
9 |
+
einops
|
10 |
+
toml
|
11 |
+
albumentations
|
12 |
+
pydantic
|
13 |
+
omegaconf
|
14 |
+
k-diffusion
|
15 |
+
open_clip_torch
|
16 |
+
prodigyopt
|
17 |
+
controlnet_aux==0.0.7
|
18 |
+
python-dotenv
|
19 |
+
lpips
|
20 |
+
pytorch_fid
|
21 |
+
optimum-quanto
|
script.py
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from huggingface_hub import snapshot_download, delete_repo, metadata_update
|
3 |
+
import uuid
|
4 |
+
import json
|
5 |
+
import yaml
|
6 |
+
import subprocess
|
7 |
+
|
8 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
9 |
+
HF_DATASET = os.environ.get("DATA_PATH")
|
10 |
+
|
11 |
+
|
12 |
+
def download_dataset(hf_dataset_path: str):
|
13 |
+
random_id = str(uuid.uuid4())
|
14 |
+
snapshot_download(
|
15 |
+
repo_id=hf_dataset_path,
|
16 |
+
token=HF_TOKEN,
|
17 |
+
local_dir=f"/tmp/{random_id}",
|
18 |
+
repo_type="dataset",
|
19 |
+
)
|
20 |
+
return f"/tmp/{random_id}"
|
21 |
+
|
22 |
+
|
23 |
+
def process_dataset(dataset_dir: str):
|
24 |
+
# dataset dir consists of images, config.yaml and a metadata.jsonl (optional) with fields: file_name, prompt
|
25 |
+
# generate .txt files with the same name as the images with the prompt as the content
|
26 |
+
# remove metadata.jsonl
|
27 |
+
# return the path to the processed dataset
|
28 |
+
|
29 |
+
# check if config.yaml exists
|
30 |
+
if not os.path.exists(os.path.join(dataset_dir, "config.yaml")):
|
31 |
+
raise ValueError("config.yaml does not exist")
|
32 |
+
|
33 |
+
# check if metadata.jsonl exists
|
34 |
+
if os.path.exists(os.path.join(dataset_dir, "metadata.jsonl")):
|
35 |
+
metadata = []
|
36 |
+
with open(os.path.join(dataset_dir, "metadata.jsonl"), "r") as f:
|
37 |
+
for line in f:
|
38 |
+
if len(line.strip()) > 0:
|
39 |
+
metadata.append(json.loads(line))
|
40 |
+
for item in metadata:
|
41 |
+
txt_path = os.path.join(dataset_dir, item["file_name"])
|
42 |
+
txt_path = txt_path.rsplit(".", 1)[0] + ".txt"
|
43 |
+
with open(txt_path, "w") as f:
|
44 |
+
f.write(item["prompt"])
|
45 |
+
|
46 |
+
# remove metadata.jsonl
|
47 |
+
os.remove(os.path.join(dataset_dir, "metadata.jsonl"))
|
48 |
+
|
49 |
+
with open(os.path.join(dataset_dir, "config.yaml"), "r") as f:
|
50 |
+
config = yaml.safe_load(f)
|
51 |
+
|
52 |
+
# update config with new dataset
|
53 |
+
config["config"]["process"][0]["datasets"][0]["folder_path"] = dataset_dir
|
54 |
+
|
55 |
+
with open(os.path.join(dataset_dir, "config.yaml"), "w") as f:
|
56 |
+
yaml.dump(config, f)
|
57 |
+
|
58 |
+
return dataset_dir
|
59 |
+
|
60 |
+
|
61 |
+
def run_training(hf_dataset_path: str):
|
62 |
+
|
63 |
+
dataset_dir = download_dataset(hf_dataset_path)
|
64 |
+
dataset_dir = process_dataset(dataset_dir)
|
65 |
+
|
66 |
+
# run training
|
67 |
+
commands = "git clone https://github.com/ostris/ai-toolkit.git ai-toolkit && cd ai-toolkit && git checkout bc693488eb3cf48ded8bc2af845059d80f4cf7d0 && git submodule update --init --recursive"
|
68 |
+
subprocess.run(commands, shell=True)
|
69 |
+
|
70 |
+
commands = f"python run.py {os.path.join(dataset_dir, 'config.yaml')}"
|
71 |
+
process = subprocess.Popen(commands, shell=True, cwd="ai-toolkit", env=os.environ)
|
72 |
+
|
73 |
+
return process, dataset_dir
|
74 |
+
|
75 |
+
|
76 |
+
if __name__ == "__main__":
|
77 |
+
process, dataset_dir = run_training(HF_DATASET)
|
78 |
+
process.wait() # Wait for the training process to finish
|
79 |
+
|
80 |
+
with open(os.path.join(dataset_dir, "config.yaml"), "r") as f:
|
81 |
+
config = yaml.safe_load(f)
|
82 |
+
repo_id = config["config"]["process"][0]["save"]["hf_repo_id"]
|
83 |
+
|
84 |
+
metadata = {
|
85 |
+
"tags": [
|
86 |
+
"autotrain",
|
87 |
+
"spacerunner",
|
88 |
+
"text-to-image",
|
89 |
+
"flux",
|
90 |
+
"lora",
|
91 |
+
"diffusers",
|
92 |
+
"template:sd-lora",
|
93 |
+
]
|
94 |
+
}
|
95 |
+
metadata_update(repo_id, metadata, token=HF_TOKEN, repo_type="model", overwrite=True)
|
96 |
+
delete_repo(HF_DATASET, token=HF_TOKEN, repo_type="dataset", missing_ok=True)
|