usage: gcc -O3 -shared -fPIC tm_vm_wordsim.c -o libtm_vm_wordsim.so
python3 wordsim_main.py --in bb6_machines.txt --out bb6_cpp.csv --steps 10000000 --bits 16 --skip-py --batch-c --entry-timeout=128
usage: gcc -O3 -shared -fPIC tm_vm_wordsim.c -o libtm_vm_wordsim.so
python3 wordsim_main.py --in bb6_machines.txt --out bb6_cpp.csv --steps 10000000 --bits 16 --skip-py --batch-c --entry-timeout=128
| # Dynamic visualization of 2-symbol TM's. After --warmup steps, bits on the tape are regrouped into bytes and color-mapped, | |
| # then the 1D tape is reshaped and truncated from the left to a 64x64 frame to be recorded every --frame-every steps for --vis frames. | |
| # ## Example usage: | |
| # https://bbchallenge.org/76708232 | |
| # python vis_tm_bytes.py | |
| # https://bbchallenge.org/43374927 | |
| # python vis_tm_bytes.py --tm=1RB0RD_1LC1LB_1RA0LB_0RE1RD_---1RA --warmup=200_000_000 | |
| # For 6-state machines, use a larger warmup (current BB(6) champion family) | |
| # python vis_tm_bytes.py --warmup=200_000_000 --vis=80_000_000 --frame-every=100_000 --tm=1RB1RA_1RC1RZ_1LD0RF_1RA0LE_0LD1RC_1RA0RE --side=64 |
| from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler | |
| import torch | |
| scheduler = EulerDiscreteScheduler(use_karras_sigmas=True) | |
| pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",scheduler=scheduler, torch_dtype=torch.float16) | |
| generator = torch.Generator("cuda").manual_seed(0) | |
| pipe = pipe.to('cuda') | |
| image = pipe("a golden retriever",num_inference_steps=30,generator=generator).images[0] | |
| image.save('test.jpg') |
| import numpy as np | |
| import torch | |
| import fire | |
| import glob | |
| def abs_ind_to_feat_file(abs_ind, cum_sz, feat_files): | |
| inds = np.argwhere(abs_ind - cum_sz >= 0) | |
| last_ind = inds[-1].item() | |
| ind_offset = cum_sz[last_ind] | |
| local_ind = abs_ind - ind_offset |
| { | |
| "model": { | |
| "type": "image_v1", | |
| "input_channels": 3, | |
| "input_size": [64, 64], | |
| "mapping_out": 256, | |
| "depths": [2, 2, 4, 4], | |
| "channels": [128, 256, 256, 512], | |
| "self_attn_depths": [false, false, true, true], | |
| "dropout_rate": 0.05, |