Skip to content

Instantly share code, notes, and snippets.

View hnyu's full-sized avatar

Haonan Yu hnyu

View GitHub Profile
@hnyu
hnyu / wan_inference.py
Last active July 8, 2025 22:57
WAN2.1 inference with trained LoRA weights
import torch
import sys
sys.path.append('../..')
from diffsynth import ModelManager, WanVideoPipeline, save_video
from PIL import Image
import time
import os
from peft import LoraConfig, get_peft_model
from diffsynth import load_state_dict
from modelscope import snapshot_download
@hnyu
hnyu / tfds2gzip.py
Last active July 8, 2025 21:55
TFDS to local gzip files
import os
import numpy as np
import joblib
import time
import alf
import tensorflow_datasets as tfds
import tensorflow as tf
from PIL import Image
import io
import pprint
@hnyu
hnyu / paligemma2_bridge_finetune.py
Created February 6, 2025 20:18
Finetuning PaliGemma2 on Bridge robot data for task success check
from typing import List, Tuple, Optional, Dict, Any
import numpy as np
import os
import cv2
import random
from pynvml import *
import logging
# Set the logging level to INFO
logging.basicConfig(level=logging.INFO)
@hnyu
hnyu / seditor_traj_visualization.py
Created July 8, 2024 17:13
Plot script for SEditor figure 4 visualization
import os
import subprocess
import numpy as np
from typing import List, Dict
import pickle
import matplotlib.collections as mcoll
from matplotlib import pyplot as plt
layout = {'hazard0': b' ?)l\xc6\xc2\xe9\xbf\xb6\x14]<\xe3J\xf2\xbf',
'hazard1': b'\xe8i\x181\xc82\xca?\xb471)\x08\xf7\xde\xbf',
@hnyu
hnyu / mujoco_speed_test.py
Last active December 16, 2022 19:20
mujoco_speed_test_multiple_agents
import os
os.environ["MUJOCO_GL"] = 'egl'
#os.chdir("./mujoco_menagerie/anybotics_anymal_b/")
os.chdir("./mujoco_menagerie/unitree_a1/")
import xmltodict
import mujoco
import mediapy as media
import numpy as np
@hnyu
hnyu / mujoco_speed_test.ipynb
Last active December 15, 2022 03:59
MuJoCo speed test (single agent)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.