# HG changeset patch
# User bgruening
# Date 1728924638 0
# Node ID 0d0561746128f453e5e4bca8fd8df83125f3de51
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/flux commit 71b3dacee16dc999cb4fa113858d6ace1781c71c
diff -r 000000000000 -r 0d0561746128 flux.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flux.py Mon Oct 14 16:50:38 2024 +0000
@@ -0,0 +1,32 @@
+import sys
+
+import torch
+from diffusers import FluxPipeline
+
+model = sys.argv[1]
+
+prompt_type = sys.argv[2]
+if prompt_type == "file":
+ with open(sys.argv[3], "r") as f:
+ prompt = f.read().strip()
+elif prompt_type == "text":
+ prompt = sys.argv[3]
+
+if model not in ["black-forest-labs/FLUX.1-dev", "black-forest-labs/FLUX.1-schnell"]:
+ print("Invalid model!")
+ sys.exit(1)
+
+
+pipe = FluxPipeline.from_pretrained(model, torch_dtype=torch.bfloat16)
+pipe.enable_sequential_cpu_offload()
+pipe.vae.enable_slicing()
+pipe.vae.enable_tiling()
+pipe.to(torch.float16)
+
+image = pipe(
+ prompt,
+ num_inference_steps=4,
+ generator=torch.Generator("cpu").manual_seed(42),
+).images[0]
+
+image.save("output.png")
diff -r 000000000000 -r 0d0561746128 flux.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flux.xml Mon Oct 14 16:50:38 2024 +0000
@@ -0,0 +1,100 @@
+
+ text-to-image model
+
+ 2024
+ 0
+
+
+ python
+ pytorch
+ torchvision
+ diffusers
+ transformers
+ accelerate
+ sentencepiece
+ protobuf
+ huggingface_hub
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @misc{flux,
+ author = {black forest labs},
+ title = {FLUX github repository},
+ howpublished = {\url{https://github.com/black-forest-labs/flux}},
+ year = {2024},
+ note = {Accessed: 2024-09-04}
+ }
+
+
+
diff -r 000000000000 -r 0d0561746128 test-data/flux_test.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/flux_test.txt Mon Oct 14 16:50:38 2024 +0000
@@ -0,0 +1,1 @@
+Extreme close-up of a spiral galaxy, direct frontal view, with highly detailed stars and nebulae. The image has sharp focus on texture and color, with ethereal cosmic lighting to capture the galaxy's natural shine and depth. The words 'Galaxy Project' are painted in large, white brush strokes with visible texture, centered across the image.
\ No newline at end of file
diff -r 000000000000 -r 0d0561746128 tool-data/huggingface.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/huggingface.loc.sample Mon Oct 14 16:50:38 2024 +0000
@@ -0,0 +1,18 @@
+
+#This is a sample file distributed with Galaxy that is used to define huggingface
+#models, using 7 columns tab separated
+#(longer whitespace are TAB characters):
+#
+#The entries are as follows:
+#
+#
+#
+#pipeline_tag (see this URL: https://huggingface.co/models?pipeline_tag=text-to-image they call it that way)
+#domain (defined by the Galaxy community, e.g. image / sequence / text)
+#free_tag (not idea yet, but could be freely used by an admin to specify more filter options)
+#version (if available)
+#Your huggingface.loc file should include the huggingface cached model folder you have stored.
+#For example:
+#
+#black-forest-labs/FLUX.1-dev FLUX.1 [dev] is an open-weight, guidance-distilled model for non-commercial applications. text-to-image image flux 1 /path/to/huggingface/that-contains/hub/models--black-forest-labs--FLUX.1-dev
+#black-forest-labs/FLUX.1-schnell FLUX.1 [schnell] is the fastest model, tailored for personal use. text-to-image image flux 1 /path/to/huggingface/that-contains/hub/models--black-forest-labs--FLUX.1-schnell
diff -r 000000000000 -r 0d0561746128 tool_data_table_conf.xml.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample Mon Oct 14 16:50:38 2024 +0000
@@ -0,0 +1,7 @@
+
+
+
+ value, name, pipeline_tag, domain, free_tag, version, path
+
+
+
\ No newline at end of file