This file contains 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
#------------------------------------------------------------- | |
# types | |
#------------------------------------------------------------- | |
type C = concept type C | |
proc name(x: C, msg: string): string | |
type AnyC = object | |
name: proc(msg: string): string # doesn't contain C | |
type A = object |
This file contains 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
# client-task-pool.py | |
from aiohttp import ClientSession, TCPConnector | |
import asyncio | |
import sys | |
from pypeln.task import TaskPool | |
limit = 1000 | |
This file contains 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
# client-async-sem.py | |
from aiohttp import ClientSession, TCPConnector | |
import asyncio | |
import sys | |
limit = 1000 | |
async def fetch(url, session): | |
async with session.get(url) as response: |
This file contains 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
# timed.sh | |
ulimit -n 3000 # increase to avoid "out of file descriptors" error | |
python server.py & | |
sleep 1 # Wait for server to start | |
/usr/bin/time --format "Memory usage: %MKB\tTime: %e seconds\tCPU usage: %P" "$@" |
This file contains 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 ClientSession, TCPConnector | |
import asyncio | |
import sys | |
import pypeln as pl | |
limit = 1000 | |
urls = ("http://localhost:8080/{}".format(i) for i in range(int(sys.argv[1]))) |
This file contains 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
MyModule: | |
b: list | |
- Initializer | |
- Parameter((5, 13), float32) | |
a: dict | |
mlps: list | |
- MLP: | |
linear1: Linear | |
w: Parameter((2, 3), float32) | |
b: Parameter((3,), float32) |
This file contains 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 ClientSession | |
from pypeln import io | |
import asyncio | |
import sys | |
async def fetch(url, session): | |
async with session.get(url) as response: | |
return await response.read() | |
async def main(): |
This file contains 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
rsync --exclude-from=.gitignore -avz -e ssh . $1 | |
while inotifywait -r -e modify,create,delete . ; do | |
rsync --exclude-from=.gitignore -avz --delete -e ssh . $1 | |
done |
This file contains 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
# PARAMETERS | |
MODEL = "ResNet50" | |
OUTPUT_DIRECTORY = "models/resnet50" | |
EPOCHS = 90 | |
BATCH_SIZE = 6 | |
IMAGE_SIZE = 224 # image size in pixels | |
DATASET = "imagenet2012:5.1.*" # TFDS dataset name and version | |
DTYPE = "float16" # float16 for mixed_precision or float32 for normal mode | |
LEARNING_RATE = 0.1 * BATCH_SIZE / 256.0 | |
MOMENTUM = 0.9 |
This file contains 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
model = elegy.Model( | |
module=MixtureModel(k=k), | |
loss=MixtureNLL(), | |
optimizer=optax.adam(3e-4), | |
) | |
model.summary(X_train[:batch_size], depth=1) | |
model.fit( | |
x=X_train, |
NewerOlder