Skip to content

Commit

Permalink
Merge pull request #333 from princeton-vl/develop
Browse files Browse the repository at this point in the history
Release v1.11.4 and v1.12.0 to public main
  • Loading branch information
araistrick authored Dec 22, 2024
2 parents e254428 + 7744dc9 commit 5968578
Show file tree
Hide file tree
Showing 26 changed files with 361 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
- name: Check for copyright statements
run: |
ruff check --output-format=github --preview --select CPY001 .
ruff check --output-format=github --preview --select CPY001 .
119 changes: 119 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Build & Release

on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

jobs:
build_sdist_purepy:
name: Build source/pure python wheels
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Build source/pure python wheels
run: |
python -m pip install build
python -m build --outdir=wheelhouse
env:
INFINIGEN_MINIMAL_INSTALL: "True"

- name: Upload to github
uses: actions/upload-artifact@v4
with:
path: wheelhouse/*
if-no-files-found: error

build_wheels:
name: Build wheel on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# we skip Windows since that results in pure Python wheels
# anyway; (compile_terrain.sh is not supported on Windows)
- os: ubuntu-latest
cibw_archs: "x86_64"
- os: ubuntu-latest
cibw_archs: "aarch64"
- os: macos-13
cibw_archs: "x86_64"
- os: macos-latest
cibw_archs: "arm64"

steps:
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew install libomp
echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1-2)" >> $GITHUB_ENV
- name: Set CXXFLAGS and LDFLAGS for macOS
if: matrix.os == 'macos-13'
run: |
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
echo "CXXFLAGS=-I/usr/local/opt/libomp/include" >> $GITHUB_ENV
echo "LDFLAGS=-Wl,-rpath,/usr/local/opt/libomp/lib -L/usr/local/opt/libomp/lib -lomp" >> $GITHUB_ENV
- name: Set CXXFLAGS and LDFLAGS for macOS
if: matrix.os == 'macos-latest'
run: |
echo "CXX=$(brew --prefix llvm@15)/bin/clang++" >> $GITHUB_ENV
echo "CXXFLAGS=-I/opt/homebrew/opt/libomp/include" >> $GITHUB_ENV
echo "LDFLAGS=-Wl,-rpath,/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/libomp/lib -lomp" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
env:
CIBW_BUILD: "cp311-*"
# `bpy` is not easily pip-installable on manylinux (no sdists either),
# so we skip tests
CIBW_TEST_COMMAND: ""
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT:
CXXFLAGS="${{ env.CXXFLAGS }}"
LDFLAGS="${{ env.LDFLAGS }}"

- name: Upload artifacts to github
uses: actions/upload-artifact@v4
with:
name: wheels-${{ runner.os }}-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl
if-no-files-found: error

publish_to_pypi:
name: Publish wheels to PyPi
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [build_sdist_purepy, build_wheels]
runs-on: ubuntu-latest
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Upload wheels to pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m pip install --upgrade twine
twine upload dist/*
17 changes: 16 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,19 @@ v1.11.1
- Make `bnurbs` CPython module optional and not installed by default

v1.11.2
- Fix opengl_gt input file symlink missing
- Fix opengl_gt input file symlink missing

v1.11.3
- Increase max camera / object animation random walk trials
- Fix scenetype gin recognition causing crashes for underwater.gin / kelpforest.gin

v1.11.4
- Fix circular / segfaulting imports when modules imported individually
- Fix ordering-dependence in unit tests
- Fix scenetype.gin crashes for underwater/kelpforest
- Increase integration test timelimit
- Add `analyze_crash_reasons` crash summary script
- Improve success rate of camera / creature animations via increased retry attempts

v1.12.0
- Publish to PyPi
2 changes: 1 addition & 1 deletion infinigen/OcMesher
Submodule OcMesher updated 1 files
+16 −12 install.sh
2 changes: 1 addition & 1 deletion infinigen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
from pathlib import Path

__version__ = "1.11.2"
__version__ = "1.12.0"


def repo_root():
Expand Down
1 change: 0 additions & 1 deletion infinigen/assets/objects/creatures/bird.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ def create_placeholder(self, i, loc, rot):
self.bvh,
self.policy,
retry_rotation=True,
max_full_retries=30,
fatal=True,
)
curve.name = f"animhelper:{self}.create_placeholder({i}).path"
Expand Down
4 changes: 1 addition & 3 deletions infinigen/assets/objects/creatures/util/boid_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ def create_placeholder(self, loc, rot, **kwargs) -> bpy.types.Object:
step_range=step_size_range,
yaw_dist=("normal", 0, 70),
)
animation_policy.animate_trajectory(
p, self.bvh, policy, retry_rotation=True, max_full_retries=20
)
animation_policy.animate_trajectory(p, self.bvh, policy, retry_rotation=True)

return p

Expand Down
3 changes: 2 additions & 1 deletion infinigen/core/constraints/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
logger = logging.getLogger(__name__)


def iter_domains(node: cl.Node) -> typing.Iterator[r.Domain]:
def iter_domains(node: "cl.Node") -> typing.Iterator["r.Domain"]:
match node:
case cl.ObjectSetExpression():
yield node, r.constraint_domain(node)
Expand Down Expand Up @@ -93,6 +93,7 @@ def check_problem_greedy_coverage(prob: cl.Problem, stages: dict[str, r.Domain])
check_coverage_errors(b, coverage, stages)


#
def check_unfinalized_constraints(prob: cl.Problem):
# TODO
return []
Expand Down
1 change: 0 additions & 1 deletion infinigen/core/constraints/example_solver/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import room
from .solve import Solver
from .state_def import State
28 changes: 15 additions & 13 deletions infinigen/core/constraints/example_solver/annealing.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ def checkpoint(self, state):

def validate_lazy_eval(
self,
state: State,
consgraph: cl.Problem,
prop_result: evaluate.EvalResult,
filter_domain: r.Domain,
state: "State",
consgraph: "cl.Problem",
prop_result: "evaluate.EvalResult",
filter_domain: "r.Domain",
):
test_memo = {}
impl_util.DISABLE_BVH_CACHE = True
Expand Down Expand Up @@ -162,10 +162,10 @@ def validate_lazy_eval(
@gin.configurable
def _move(
self,
consgraph: cl.Node,
state: State,
move: Move,
filter_domain: r.Domain,
consgraph: "cl.Node",
state: "State",
move: "Move",
filter_domain: "r.Domain",
do_lazy_eval=True,
validate_lazy_eval=False,
):
Expand All @@ -188,11 +188,11 @@ def _move(
def retry_attempt_proposals(
self,
propose_func: typing.Callable,
consgraph: cl.Node,
state: State,
consgraph: "cl.Node",
state: "State",
temp: float,
filter_domain: r.Domain,
) -> typing.Tuple[Move, evaluate.EvalResult, int]:
filter_domain: "r.Domain",
) -> typing.Tuple["Move", "evaluate.EvalResult", int]:
move_gen = propose_func(consgraph, state, filter_domain, temp)

move = None
Expand Down Expand Up @@ -224,7 +224,9 @@ def curr_temp(self) -> float:
temp = np.clip(temp, self.final_temp, self.initial_temp)
return temp

def metrop_hastings_with_viol(self, prop_result: evaluate.EvalResult, temp: float):
def metrop_hastings_with_viol(
self, prop_result: "evaluate.EvalResult", temp: float
):
prop_viol = prop_result.viol_count()
curr_viol = self.curr_result.viol_count()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@


def _resolve_toplevel_var(
dom: r.Domain,
state: state_def.State,
limits: dict[t.Variable, int] = None,
dom: "r.Domain",
state: "state_def.State",
limits: dict["t.Variable", int] = None,
) -> typing.Iterator[str]:
"""
Find and yield all valid substitutions of a toplevel VariableTag in a given dom
Expand Down Expand Up @@ -58,11 +58,11 @@ def _resolve_toplevel_var(


def substitutions(
dom: r.Domain,
state: state_def.State,
limits: dict[t.Variable, int] | None = None,
dom: "r.Domain",
state: "state_def.State",
limits: dict["t.Variable", int] | None = None,
nonempty: bool = False,
) -> typing.Iterator[r.Domain]:
) -> typing.Iterator["r.Domain"]:
"""Find all t.Variable in d's tags or relations, and return one Domain for each possible assignment
limits cuts off enumeration of each varname with some integer count
Expand Down
8 changes: 4 additions & 4 deletions infinigen/core/constraints/example_solver/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ def choose_move_type(
weights = np.array([s if isinstance(s, (float, int)) else s(t) for s in scheds])
return np.random.choice(funcs, p=weights / weights.sum())

def solve_rooms(self, scene_seed, consgraph: cl.Problem, filter: r.Domain):
def solve_rooms(self, scene_seed, consgraph: "cl.Problem", filter: "r.Domain"):
self.state, _, _ = self.room_solver_fn(scene_seed, consgraph).solve()
return self.state

@gin.configurable
def solve_objects(
self,
consgraph: cl.Problem,
filter_domain: r.Domain,
consgraph: "cl.Problem",
filter_domain: "r.Domain",
var_assignments: dict[str, str],
n_steps: int,
desc: str,
Expand Down Expand Up @@ -216,6 +216,6 @@ def solve_objects(

return self.state

def get_bpy_objects(self, domain: r.Domain) -> list[bpy.types.Object]:
def get_bpy_objects(self, domain: "r.Domain") -> list[bpy.types.Object]:
objkeys = domain_contains.objkeys_in_dom(domain, self.state)
return [self.state.objs[k].obj for k in objkeys]
10 changes: 8 additions & 2 deletions infinigen/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,18 @@ def report_fail(msg):

builtin_local_addons = set(a.__name__ for a in addon_utils.modules(refresh=True))

if addon not in builtin_local_addons and not allow_online:
if (
(addon not in builtin_local_addons)
and (long not in builtin_local_addons)
and (not allow_online)
):
report_fail(f"{addon=} not found and online install is disabled")

try:
if long in builtin_local_addons:
logger.info(f"Addon {addon} already in blender local addons, attempt to enable it.")
logger.info(
f"Addon {addon} already in blender local addons, attempt to enable it."
)
bpy.ops.preferences.addon_enable(module=long)
else:
bpy.ops.extensions.userpref_allow_online()
Expand Down
5 changes: 5 additions & 0 deletions infinigen/core/nodes/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (C) 2024, Princeton University.
# This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.

# Authors: Lingjie Mei

import logging

import bpy
Expand Down
2 changes: 1 addition & 1 deletion infinigen/core/placement/animation_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def animate_trajectory(
policy_func,
validate_pose_func=None,
max_step_tries=25,
max_full_retries=10,
max_full_retries=40,
retry_rotation=False,
verbose=True,
fatal=False,
Expand Down
1 change: 1 addition & 0 deletions infinigen/core/rendering/post_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def load_single_channel(p):
def load_depth(p):
return load_single_channel(p)


def load_normals(p):
return load_exr(p)[..., [2, 0, 1]] * np.array([-1.0, 1.0, 1.0])

Expand Down
4 changes: 4 additions & 0 deletions infinigen/datagen/configs/base.gin
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ sample_scene_spec.config_distribution = [
("coast", 4),
("arctic", 1),
("snowy_mountain", 1),

# keep these here even if 0, otherwise sample_config_distribution will clash with them if they are provided manually by the user
("under_water", 0),
("kelp_forest", 0),
]
2 changes: 1 addition & 1 deletion infinigen/datagen/manage_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def manage_datagen_jobs(
all_scenes: list[dict],
elapsed: float,
num_concurrent: int,
disk_sleep_threshold=0.95,
disk_sleep_threshold=0.99,
):
if LocalScheduleHandler._inst is not None:
sys.path = ORIG_SYS_PATH # hacky workaround because bpy module breaks with multiprocessing
Expand Down
Loading

0 comments on commit 5968578

Please sign in to comment.