Bartosz commited on
Commit
1b5c2a5
·
verified ·
1 Parent(s): c19a0b2

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - text-to-image
4
+ - flux
5
+ - lora
6
+ - diffusers
7
+ - template:sd-lora
8
+ - fluxgym
9
+
10
+
11
+ base_model: black-forest-labs/FLUX.1-dev
12
+ instance_prompt: prci
13
+ license: other
14
+ license_name: flux-1-dev-non-commercial-license
15
+ license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
16
+ ---
17
+
18
+ # photorealistic-car-images
19
+
20
+ A Flux LoRA trained on a local computer with [Fluxgym](https://github.com/cocktailpeanut/fluxgym)
21
+
22
+ <Gallery />
23
+
24
+ ## Trigger words
25
+
26
+ You should use `prci` to trigger the image generation.
27
+
28
+ ## Download model and use it with ComfyUI, AUTOMATIC1111, SD.Next, Invoke AI, Forge, etc.
29
+
30
+ Weights for this model are available in Safetensors format.
31
+
dataset.toml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [general]
2
+ shuffle_caption = false
3
+ caption_extension = '.txt'
4
+ keep_tokens = 1
5
+
6
+ [[datasets]]
7
+ resolution = 768
8
+ batch_size = 1
9
+ keep_tokens = 1
10
+
11
+ [[datasets.subsets]]
12
+ image_dir = 'D:\MISC\pinokio\api\fluxgym.git\datasets\photorealistic-car-images'
13
+ class_tokens = 'prci'
14
+ num_repeats = 6
photorealistic-car-images-000004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a17825614eb6b112ff4e00a959dc2ea23db1a3616f97e6b912f2cb277190c40
3
+ size 158646024
photorealistic-car-images.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e1911cc2573fdd8f668d347771a3cce749ca57823a77e23f20891012b3a9895
3
+ size 158646024
sample_prompts.txt ADDED
File without changes
train.bat ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accelerate launch ^
2
+ --mixed_precision bf16 ^
3
+ --num_cpu_threads_per_process 1 ^
4
+ sd-scripts/flux_train_network.py ^
5
+ --pretrained_model_name_or_path "D:\MISC\pinokio\api\fluxgym.git\models\unet\bdsqlsz\flux1-dev2pro-single\flux1-dev2pro.safetensors" ^
6
+ --clip_l "D:\MISC\pinokio\api\fluxgym.git\models\clip\clip_l.safetensors" ^
7
+ --t5xxl "D:\MISC\pinokio\api\fluxgym.git\models\clip\t5xxl_fp16.safetensors" ^
8
+ --ae "D:\MISC\pinokio\api\fluxgym.git\models\vae\ae.sft" ^
9
+ --cache_latents_to_disk ^
10
+ --save_model_as safetensors ^
11
+ --sdpa --persistent_data_loader_workers ^
12
+ --max_data_loader_n_workers 2 ^
13
+ --seed 42 ^
14
+ --gradient_checkpointing ^
15
+ --mixed_precision bf16 ^
16
+ --save_precision bf16 ^
17
+ --network_module networks.lora_flux ^
18
+ --network_dim 16 ^
19
+ --optimizer_type adafactor ^
20
+ --optimizer_args "relative_step=False" "scale_parameter=False" "warmup_init=False" ^
21
+ --lr_scheduler constant_with_warmup ^
22
+ --max_grad_norm 0.0 ^
23
+ --learning_rate 8e-4 ^
24
+ --cache_text_encoder_outputs ^
25
+ --cache_text_encoder_outputs_to_disk ^
26
+ --fp8_base ^
27
+ --highvram ^
28
+ --max_train_epochs 7 ^
29
+ --save_every_n_epochs 4 ^
30
+ --dataset_config "D:\MISC\pinokio\api\fluxgym.git\outputs\photorealistic-car-images\dataset.toml" ^
31
+ --output_dir "D:\MISC\pinokio\api\fluxgym.git\outputs\photorealistic-car-images" ^
32
+ --output_name photorealistic-car-images ^
33
+ --timestep_sampling shift ^
34
+ --discrete_flow_shift 3.1582 ^
35
+ --model_prediction_type raw ^
36
+ --guidance_scale 1 ^
37
+ --loss_type l2 ^
uploader.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import HfApi, login
2
+ import os
3
+ import time
4
+ import sys
5
+
6
+ def upload_to_huggingface(repo_name, wait_minutes):
7
+ # Convert minutes to seconds and wait
8
+ print(f"Script will upload files in {wait_minutes} minutes...")
9
+ time.sleep(wait_minutes * 60)
10
+
11
+ # Initialize Hugging Face API
12
+ api = HfApi()
13
+
14
+ try:
15
+ # Authenticate using your Hugging Face API token
16
+ hf_token = os.getenv("HF_API_TOKEN")
17
+ if not hf_token:
18
+ raise ValueError("Hugging Face API token is not set. Please set it in the environment variable 'HF_API_TOKEN'.")
19
+ login(token=hf_token)
20
+
21
+ api.create_repo(repo_id=repo_name, private=True, exist_ok=True)
22
+
23
+ # Get current directory
24
+ current_dir = os.getcwd()
25
+
26
+ print("Starting upload to Hugging Face...")
27
+
28
+ # Upload all files from current directory
29
+ api.upload_folder(
30
+ folder_path=current_dir,
31
+ repo_id=repo_name,
32
+ repo_type="model"
33
+ )
34
+
35
+ print("Upload completed successfully!")
36
+
37
+ except Exception as e:
38
+ print(f"An error occurred: {str(e)}")
39
+
40
+ if __name__ == "__main__":
41
+ if len(sys.argv) != 3:
42
+ print("Usage: python script.py <repository_name> <minutes_to_wait>")
43
+ print("Example: python script.py 'your-username/model-name' 120")
44
+ sys.exit(1)
45
+
46
+ repo_name = sys.argv[1]
47
+ wait_minutes = int(sys.argv[2])
48
+
49
+ upload_to_huggingface(repo_name, wait_minutes)