Skip to content

Instantly share code, notes, and snippets.

@machinaut
machinaut / gravity.py
Created February 9, 2018 19:40
mujoco-py - Change Model Parameters on the Fly
#!/usr/bin/env python
import time
import numpy as np
from mujoco_py import load_model_from_xml, MjSim, MjViewer
XML = '''
<mujoco>
<worldbody>
<geom name='floor' pos='0 0 0' size='5 5 .125' type='plane' condim='3'/>
@batzner
batzner / tensorflow_rename_variables.py
Last active May 25, 2023 06:15
Small python script to rename variables in a TensorFlow checkpoint
import sys, getopt
import tensorflow as tf
usage_str = 'python tensorflow_rename_variables.py --checkpoint_dir=path/to/dir/ ' \
'--replace_from=substr --replace_to=substr --add_prefix=abc --dry_run'
def rename(checkpoint_dir, replace_from, replace_to, add_prefix, dry_run):
checkpoint = tf.train.get_checkpoint_state(checkpoint_dir)