Skip to content

Commit 471df8e

Browse files
cog-safe-push with test cases
1 parent 3d03901 commit 471df8e

File tree

2 files changed

+122
-37
lines changed

2 files changed

+122
-37
lines changed

.github/workflows/push.yaml

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,10 @@ on:
44
workflow_dispatch:
55
branches: [main]
66
inputs:
7-
test_only:
7+
no_push:
88
description: 'Test only, without pushing to prod'
99
type: boolean
1010
default: true
11-
compare_outputs:
12-
description: 'Compare hotswap prediction outputs between existing version and new version'
13-
type: boolean
14-
default: true
15-
compare_trainer_outputs:
16-
description: 'Compare training outputs between existing version and new version'
17-
type: boolean
18-
default: true
1911

2012
jobs:
2113
cog-safe-push:
@@ -46,35 +38,9 @@ jobs:
4638
run: |
4739
pip install git+https://github.com/replicate/cog-safe-push.git
4840
49-
- name: Run cog-safe-push to test the trainer
50-
if: ${{ github.event.inputs.compare_trainer_outputs == 'true' }}
51-
env:
52-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
53-
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
54-
run: |
55-
cog-safe-push -vv \
56-
--test-model=replicate-internal/test-flux-fine-tuner \
57-
--test-only \
58-
--train \
59-
--train-destination=replicate-internal/test-flux-fine-tuner-dest \
60-
--predict-timeout=480 \
61-
-i input_images=https://github.com/andreasjansson/sprites-dataset/raw/main/sprites.zip \
62-
-i steps=100 \
63-
ostris/flux-dev-lora-trainer
64-
65-
- name: Run cog-safe-push to test the predictor and optionally push to production
41+
- name: Run cog-safe-push to test the trainer and predictor and optionally push to production
6642
env:
6743
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
6844
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
6945
run: |
70-
cog-safe-push -vv \
71-
--test-model=replicate-internal/test-flux-fine-tuner \
72-
${{ github.event.inputs.test_only == 'true' && '--test-only' || '' }} \
73-
${{ github.event.inputs.compare_outputs == 'false' && '--no-compare-outputs' || '' }} \
74-
-i replicate_weights="https://replicate.delivery/yhqm/iWjMZHd2T35kI5jaUkaG3Jb43MeA67PpYjKZQeifvTEf9yTNB/trained_model.tar" \
75-
-i extra_lora="(omit)^50%" \
76-
-i extra_lora="fofr/flux-pixar-cars" \
77-
-i extra_lora="huggingface.co/fofr/flux-wrong" \
78-
-i extra_lora="https://civitai.com/api/download/models/731747?type=Model&format=SafeTensor" \
79-
--predict-timeout=600 \
80-
ostris/flux-dev-lora-trainer
46+
cog-safe-push -vv ${{ github.event.inputs.no_push == 'true' && '--no-push' || '' }}

cog-safe-push.yaml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
model: ostris/flux-dev-lora-trainer
2+
test_model: replicate-internal/test-flux-fine-tuner
3+
predict:
4+
compare_outputs: false
5+
predict_timeout: 300
6+
test_cases:
7+
8+
# basic
9+
- inputs:
10+
prompt: PLSM style, an image of a tiger, made of yellow, red, and purple goo plasma
11+
num_outputs: 1
12+
lora_scale: 1.1
13+
num_inference_steps: 28
14+
guidance_scale: 1.5
15+
seed: 5259
16+
output_format: jpg
17+
replicate_weights: https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar
18+
match_url: https://replicate.delivery/yhqm/1jbh5xu9KqaoAV0fG8z3rhaN6ei5fyQEHffTJePLUZdXi182E/out-0.jpg
19+
20+
# img2img and custom size
21+
- inputs:
22+
prompt: "PLSM style, an image of a formula one car, made of yellow, red, and purple goo plasma"
23+
num_outputs: 1
24+
lora_scale: 1.0
25+
aspect_ratio: "custom"
26+
width: 500
27+
height: 256
28+
num_inference_steps: 20
29+
model: "dev"
30+
guidance_scale: 1.5
31+
replicate_weights: "https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar"
32+
output_format: "jpg"
33+
output_quality: 90
34+
image: "https://storage.googleapis.com/cog-safe-push-public/fast-car.jpg"
35+
prompt_strength: 0.9
36+
seed: 12919
37+
match_url: "https://replicate.delivery/yhqm/ySRQ9Kchm3pQAZmG5CsWuJJnrIUmI7KfffURlgNXRccTBo3mA/out-0.jpg"
38+
39+
# inpainting
40+
- inputs:
41+
prompt: "PLSM style, an image of a tiger, made of yellow, red, and purple goo plasma"
42+
num_outputs: 1
43+
lora_scale: 0.8
44+
aspect_ratio: custom
45+
width: 500
46+
height: 256
47+
num_inference_steps: 20
48+
model: "dev"
49+
guidance_scale: 1.5
50+
replicate_weights: "https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar"
51+
output_format: "jpg"
52+
output_quality: 90
53+
prompt_strength: 1.0
54+
image: "https://replicate.delivery/pbxt/LbXcDNOFtOMiBChe9QHHbeNJ5KcoTNfWEGmIxswhaexvXWEs/Screenshot%202024-09-11%20at%2014.36.07.png"
55+
mask: "https://replicate.delivery/pbxt/LbXcE8bXqlTqPWIDb3SFFuJzIUMKSUscnqF97XVv0K2coEwr/Screenshot%202024-09-11%20at%2014.37.41.png"
56+
seed: 64090
57+
match_url: "https://replicate.delivery/yhqm/NwelDMqsy234YaQesvcpWxsxmlKYlsgRkBW9JBXAfomXYo3mA/out-0.jpg"
58+
59+
# aspect ratio
60+
- inputs:
61+
prompt: PLSM style, an image of a tiger, made of yellow, red, and purple goo plasma
62+
aspect_ratio: "16:9"
63+
num_outputs: 1
64+
lora_scale: 1.1
65+
num_inference_steps: 28
66+
guidance_scale: 1.5
67+
seed: 16726
68+
output_format: jpg
69+
replicate_weights: https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar
70+
match_url: https://replicate.delivery/yhqm/sedcOpLQ48XWE6KrjhRL9sIkuH6AJJI6Xix23ArqZ2wNr5tJA/out-0.jpg
71+
72+
# schnell
73+
- inputs:
74+
prompt: PLSM style, an image of a tiger, made of yellow, red, and purple goo plasma
75+
num_outputs: 1
76+
lora_scale: 1.1
77+
num_inference_steps: 4
78+
model: schnell
79+
guidance_scale: 1.5
80+
seed: 16726
81+
output_format: jpg
82+
replicate_weights: https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar
83+
match_url: https://replicate.delivery/yhqm/hHjTKpqSfjy4CqNzmNoWcYGW4WkYH069E4GcMvlkjaSRr5tJA/out-0.jpg
84+
85+
# extra lora
86+
- inputs:
87+
prompt: PLSM style, an image of a man ANDRS, made of yellow, red, and purple goo plasma
88+
num_outputs: 1
89+
lora_scale: 0.8
90+
num_inference_steps: 20
91+
model: dev
92+
guidance_scale: 1.5
93+
seed: 413
94+
extra_lora: andreasjansson/flux-me
95+
extra_lora_scale: 1.1
96+
replicate_weights: https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar
97+
output_format: jpg
98+
output_quality: 90
99+
match_url: https://replicate.delivery/yhqm/jpyztFCfmetarE6p9Zt8VL2wfJpzyssOEtrX3ieGLspEee82E/out-0.jpg
100+
101+
fuzz:
102+
fixed_inputs:
103+
replicate_weights: https://replicate.delivery/yhqm/MHJmIF7zlLKXPNN9LKN5yxYUuC7SyzKjMBtqeVwUGdPCpqqJA/trained_model.tar
104+
disabled_inputs:
105+
- extra_lora
106+
duration: 120
107+
iterations: 5
108+
109+
train:
110+
train_timeout: 600
111+
test_cases:
112+
113+
# tiny training with autocaption
114+
- inputs:
115+
input_images: "https://replicate.delivery/pbxt/LbXqvBzG3Bfo6CDkIkBNo8a8v6GWZGQrqxBrgeRpaQ1knkyD/me-tiny.zip"
116+
steps: 50
117+
autocaption: true
118+
trigger_word: NDRS
119+
match_prompt: "A dictionary of a version and weights which are a .tar file"

0 commit comments

Comments
 (0)