Skip to content

Commit 7ee46ed

Browse files
mjanuszcopybara-github
authored andcommitted
Open source the JAX SECGAN code.
PiperOrigin-RevId: 959585059
1 parent b8be282 commit 7ee46ed

7 files changed

Lines changed: 2218 additions & 0 deletions

File tree

ffn/secgan/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2026 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================

ffn/secgan/main.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2026 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
16+
"""Main entry point for SECGAN training."""
17+
18+
from collections.abc import Sequence
19+
20+
from absl import app
21+
from absl import flags
22+
from connectomics.jax import training
23+
from ffn.secgan import train
24+
import jax
25+
26+
FLAGS = flags.FLAGS
27+
28+
training.define_training_flags()
29+
30+
31+
def main(argv: Sequence[str]) -> None:
32+
if len(argv) > 1:
33+
raise app.UsageError('Too many command-line arguments.')
34+
35+
# Disable space-to-batch XLA transform which crashes on small spatial dims.
36+
if 'xla_tpu_run_space_to_batch' in flags.FLAGS:
37+
flags.FLAGS.xla_tpu_run_space_to_batch = False
38+
if 'xla_tpu_run_space_to_batch_on_new_platforms' in flags.FLAGS:
39+
flags.FLAGS.xla_tpu_run_space_to_batch_on_new_platforms = False
40+
41+
training.prep_training()
42+
train.train_and_evaluate(FLAGS.config, FLAGS.workdir)
43+
44+
45+
if __name__ == '__main__':
46+
jax.config.config_with_absl()
47+
app.run(main)

0 commit comments

Comments
 (0)