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
# ------------------ node ------------------ | |
# https://nodejs.org/en/download | |
# Download and install nvm: | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash | |
# in lieu of restarting the shell | |
\. "$HOME/.nvm/nvm.sh" | |
# Download and install Node.js: |
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
# pip install udocker | |
udocker pull vllm/vllm-openai:latest | |
udocker create --name=vllm vllm/vllm-openai:latest | |
udocker setup --nvidia --force vllm | |
udocker run \ | |
--volume="/${PWD}:/workspace" \ |
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
# pip install udocker | |
udocker pull lmsysorg/sglang:latest | |
udocker create --name=sglang lmsysorg/sglang:latest | |
udocker setup --nvidia sglang | |
udocker run \ | |
--volume="/${PWD}:/workspace" \ |
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 wandb | |
from tqdm import tqdm | |
WANDB_PROJECT = "project" | |
TEST_CHANGES = True # Run once before changing | |
api = wandb.Api() | |
runs = [run for run in api.runs(WANDB_PROJECT)] | |
print(f"{len(runs)} runs found") |
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 zipfile import ZipFile | |
import os | |
EXCLUDE = ['./wandb', './.history', './data', './__pycache__', './results', './models', | |
'./logs', './config.json', './saved_configs', './saved_models', './.ipynb_checkpoints'] | |
INCLUDE = ['.py', '.sh'] | |
def create(filename): | |
not_excluded = lambda root: not any(root.startswith(path) for path in EXCLUDE) |
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
# Ugly Code | |
def set(var, val): | |
if var not in mp: | |
return False | |
mp[var] = val | |
return True | |
if set(count, 1): | |
pass |
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 check_password(username, password): | |
user = user_model.find_by_username(username) | |
if user.password != password: | |
user.increase_wrong_attempt() # Side Effect | |
return False | |
return True |
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 one_argument(*args): | |
pass | |
def two_arguemnts(name, *args): | |
pass | |
def three_arguments(name, count, *args): | |
pass |
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
# Ugly Code | |
add_address(road, block, city, state, country) | |
# Clean Code | |
add_address(address: Address) |
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
# Ugly code | |
def call(arr): | |
arr.append(1) | |
call(arr) | |
# Clean Code | |
def call(arr): | |
arr.append(1) | |
return arr |
NewerOlder