This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkg update | |
| pkg upgrade -y | |
| pkg install wget git rust tmux which gradle python android-tools -y | |
| git clone https://github.com/NvChad/starter ~/.config/nvim | |
| # android setup | |
| wget https://github.com/lzhiyong/termux-ndk/releases/download/android-ndk/android-ndk-r27b-aarch64.zip && unzip android-ndk-r27b-aarch64.zip && rm android-ndk-r27b-aarch64.zip | |
| wget https://github.com/lzhiyong/termux-ndk/releases/download/android-sdk/android-sdk-aarch64.zip && unzip android-sdk-aarch64.zip && rm android-sdk-aarch64.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jax.numpy as jnp | |
| from jax import random | |
| class JaxCartPole: | |
| """ | |
| Based on OpenAI Gym Cartpole | |
| https://github.com/openai/gym/blob/master/gym/envs/classic_control/cartpole.py | |
| """ | |
| def __init__(self): | |
| self.gravity = 9.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fori_body(i, val): | |
| env_state, action_key, all_obsv, all_reward, all_done = val | |
| action = random.randint(action_key, (1,), 0, 2)[0] | |
| action_key = random.split(action_key)[0] | |
| env_state, obsv, reward, done, info = env.step(env_state, action) | |
| all_obsv = all_obsv.at[i].set(obsv) | |
| all_reward = all_reward.at[i].set(reward) | |
| all_done = all_done.at[i].set(done) | |
| val = (env_state, action_key, all_obsv, all_reward, all_done) | |
| return val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jax.numpy as jnp | |
| from jax import random | |
| class SkeletonEnv: | |
| def __init__(self): | |
| self.random_limit = 0.05 | |
| def _get_obsv(self, state): | |
| return state |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gym | |
| import math | |
| import torch | |
| from gym import spaces, logger | |
| import numpy as np | |
| class Pendulum(gym.Env): | |
| metadata = { | |
| 'render.modes': ['human', 'rgb_array'], | |
| 'video.frames_per_second': 30 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import requests | |
| import time | |
| import pyarrow | |
| import torchvision | |
| import torch | |
| MAX_BATCH_SIZE = 1 | |
| TEST_CORRECT_OUTPUT = False | |
| if TEST_CORRECT_OUTPUT: | |
| MODEL = torchvision.models.resnet18(pretrained=True).eval() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import time | |
| import torchvision | |
| import torch | |
| DEVICE = "cuda" | |
| MODEL = torchvision.models.resnet18(pretrained=True).eval().to(DEVICE) | |
| BATCH_SIZE = 64 | |
| BATCHES = 100 | |
| x_cpu = torch.from_numpy(np.random.random((BATCH_SIZE, 3, 256, 256)) | |
| .astype(np.float32)).pin_memory() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from aiohttp import web | |
| import argparse | |
| import asyncio | |
| from dataclasses import dataclass | |
| from io import BytesIO | |
| import numpy as np | |
| import pyarrow | |
| import prometheus_client as pc | |
| import time | |
| import torch |
NewerOlder