Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pvl-bot committed Dec 24, 2024
2 parents 5968578 + 0c0d368 commit d86762e
Show file tree
Hide file tree
Showing 18 changed files with 174 additions and 62 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ env:
jobs:

checks:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
Expand Down
11 changes: 10 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,13 @@ v1.11.4
- Improve success rate of camera / creature animations via increased retry attempts

v1.12.0
- Publish to PyPi
- Publish to PyPi

v1.12.1
- Fix blender_gt crash from errored object in global_flat_shading
- Replace diameter with radius in butil.spawn_capsule
- Fix ignored blender_gt sample count config
- Fix outdated bbox input for camera_pose_proposal
- Bugfix stdout passthrough mode crashing due to no logfile created
- Add normalmaps to integration test viewer, misc test fixes
- Avoid rare duplicate names in indoor solver
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.12.0"
__version__ = "1.12.1"


def repo_root():
Expand Down
11 changes: 8 additions & 3 deletions infinigen/core/constraints/example_solver/propose_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ def propose_addition_bound_gen(
for i, assignments in enumerate(all_assignments):
logger.debug("Found assignments %d %s %s", i, len(assignments), assignments)

def sample_name():
return f"{np.random.randint(1e6):04d}_{gen_class.__name__}"

target_name = next(
sample_name() for _ in range(100) if sample_name() not in curr.objs
)

yield moves.Addition(
names=[
f"{np.random.randint(1e6):04d}_{gen_class.__name__}"
], # decided later
names=[target_name], # decided later
gen_class=gen_class,
relation_assignments=assignments,
temp_force_tags=prop_dom.tags,
Expand Down
5 changes: 4 additions & 1 deletion infinigen/core/placement/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@ def __call__(self, camera_rig, frame_curr, retry_pct, bvh):
bbox = (camera_rig.location - margin, camera_rig.location + margin)

for _ in range(self.retries):
res = camera_pose_proposal(bvh, bbox) # !
res = camera_pose_proposal(
scene_bvh=bvh,
location_sample=lambda: np.random.uniform(*bbox),
)
if res is None:
continue
dist = np.linalg.norm(np.array(res.loc) - np.array(camera_rig.location))
Expand Down
7 changes: 6 additions & 1 deletion infinigen/core/rendering/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def global_flat_shading():
vol_socket = node.inputs["Volume"]
if len(vol_socket.links) > 0:
nw.links.remove(vol_socket.links[0])
bpy.context.view_layer.update()

for obj in bpy.context.scene.view_layers["ViewLayer"].objects:
if obj.type != "MESH":
Expand Down Expand Up @@ -389,11 +390,12 @@ def render_image(
camera: bpy.types.Object,
frames_folder,
passes_to_save,
flat_shading=False,
render_resolution_override=None,
excludes=[],
use_dof=False,
dof_aperture_fstop=2.8,
flat_shading=False,
override_num_samples=None,
):
tic = time.time()

Expand All @@ -408,6 +410,9 @@ def render_image(

camrig_id, subcam_id = cam_util.get_id(camera)

if override_num_samples is not None: # usually used for GT
bpy.context.scene.cycles.samples = override_num_samples

if flat_shading:
with Timer("Set object indices"):
object_data = set_pass_indices()
Expand Down
2 changes: 1 addition & 1 deletion infinigen/core/util/blender.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def spawn_capsule(rad, height, us=32, vs=16):
bpy.context.collection.objects.link(obj)

bm = bmesh.new()
bmesh.ops.create_uvsphere(bm, u_segments=us, v_segments=vs, diameter=2 * rad)
bmesh.ops.create_uvsphere(bm, u_segments=us, v_segments=vs, radius=rad)

for v in bm.verts:
if v.co.z > 0:
Expand Down
Empty file.
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions infinigen/datagen/configs/stdout_inline.gin
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LocalScheduleHandler.use_gpu = False
local_submit_cmd.stdout_passthrough = True
print_stats_block.mute = True
56 changes: 39 additions & 17 deletions infinigen/datagen/manage_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,18 @@ def slurm_submit_cmd(

@gin.configurable
def local_submit_cmd(
cmd, folder: Path, name: str, use_scheduler=False, passthrough=False, **kwargs
cmd,
folder: Path,
name: str,
use_scheduler=False,
stdout_passthrough: bool = False,
**kwargs,
):
ExecutorClass = ScheduledLocalExecutor if use_scheduler else ImmediateLocalExecutor
log_folder = (folder / "logs") if not passthrough else None
executor = ExecutorClass(folder=log_folder)
log_folder = folder / "logs"
log_folder.mkdir(exist_ok=True)

executor = ExecutorClass(folder=log_folder, stdout_passthrough=stdout_passthrough)
executor.update_parameters(name=name, **kwargs)

if callable(cmd[0]):
Expand Down Expand Up @@ -338,9 +345,15 @@ def update_symlink(scene_folder, scenes):
to = scene_folder / "logs" / f"{new_name}.out"
std_out = scene_folder / "logs" / f"{scene.job_id}_0_log.out"

if not std_out.exists():
raise FileNotFoundError(
f"{std_out=} does not exist during attempt to symlink from {to=}"
)

if os.path.islink(to):
os.unlink(to)
os.unlink(scene_folder / "logs" / f"{new_name}.err")

os.symlink(std_out.resolve(), to)
os.symlink(
std_out.with_suffix(".err").resolve(),
Expand Down Expand Up @@ -704,6 +717,27 @@ def manage_datagen_jobs(
return log_stats


@gin.configurable
def print_stats_block(
output_folder: Path,
start_time: datetime,
log_stats: dict,
mute: bool = False,
):
if mute:
return

now = datetime.now()

print(
f'{args.output_folder} {start_time.strftime("%m/%d %I:%M%p")} -> {now.strftime("%m/%d %I:%M%p")}'
)
print("=" * 60)
for k, v in sorted(log_stats.items()):
print(f"{k.ljust(30)} : {v}")
print("-" * 60)


@gin.configurable
def main(args, shuffle=True, wandb_project="render", upload_commandfile_method=None):
command_path = args.output_folder / "datagen_command.sh"
Expand Down Expand Up @@ -752,25 +786,14 @@ def main(args, shuffle=True, wandb_project="render", upload_commandfile_method=N

start_time = datetime.now()
while any(j["all_done"] == SceneState.NotDone for j in all_scenes):
now = datetime.now()

if args.print_stats:
print(
f'{args.output_folder} {start_time.strftime("%m/%d %I:%M%p")} -> {now.strftime("%m/%d %I:%M%p")}'
)

log_stats = manage_datagen_jobs(
all_scenes, elapsed=(now - start_time).total_seconds()
all_scenes, elapsed=(datetime.now() - start_time).total_seconds()
)

if wandb is not None:
wandb.log(log_stats)

if args.print_stats:
print("=" * 60)
for k, v in sorted(log_stats.items()):
print(f"{k.ljust(30)} : {v}")
print("-" * 60)
print_stats_block(args.output_folder, start_time, log_stats)

time.sleep(2)

Expand Down Expand Up @@ -878,7 +901,6 @@ def main(args, shuffle=True, wandb_project="render", upload_commandfile_method=N
parser.add_argument(
"-v", "--verbose", action="store_const", dest="loglevel", const=logging.INFO
)
parser.add_argument("--print_stats", type=int, default=1)
args = parser.parse_args()

using_upload = any("upload" in x for x in args.pipeline_configs)
Expand Down
Loading

0 comments on commit d86762e

Please sign in to comment.