Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

CUDA_VISIBLE_DEVICES=0 python train.py
--gpu_ids 0 --dataroot ./datasets/ebike_data
--name locations_FastCUT --CUT_mode FastCUT --n_epochs 30
@zredlined
zredlined / delete_unshared_projects.py
Created January 10, 2022 18:05
Delete any projects in Gretel that are not shared to more than one person
import logging
from gretel_client import configure_session, ClientConfig, projects
from gretel_client.helpers import do_api_call
logging.getLogger().setLevel(logging.INFO)
def clean_projects():
""" Delete any projects that are not shared to more than one person """
for project in projects.search_projects():
#!/bin/bash
# Initialize conda environment
echo 'Create Conda env? Type y or n and then press [ENTER]:'
read create_env
if [ $create_env = "y" ];
then
echo "Provide name for Conda virtualenv and then press [ENTER]:"
read env_name
@zredlined
zredlined / setup_tensorflow_gpu.sh
Last active May 7, 2021 18:25
Install TensorFlow 2.4 with GPU support
#!/bin/bash
# Initialize conda environment
echo 'Create Conda env? Type y or n and then press [ENTER]:'
read create_env
if [ $create_env = "y" ];
then
echo "Provide name for Conda virtualenv and then press [ENTER]:"
read env_name
def plot_timeseries(filenames: list):
""" Plot a list of timeseries CSVs to a single graph """
combined_df = pd.DataFrame()
for filename in filenames:
df = pd.read_csv(filename)
df['date'] = pd.to_datetime(df['date'])
df['label'] = filename
combined_df = pd.concat([combined_df, df])
# Use the model to generate synthetic datasets
seed_data = json.loads(trends_df[seed_fields].to_json(orient="records"))
for dataset in range(5):
model.generate(max_invalid=1e5,
num_proc=1, # disable paralellism when using seed data
seed_fields=seed_data)
df = restore_daily(model.get_synthetic_df(), start, trend_col)
df.to_csv(f'synthetic-data-{dataset}.csv', index=False)
# Create the Gretel Synthtetics Training / Model Configuration
from pathlib import Path
from gretel_helpers.synthetics import create_df, SyntheticDataBundle
config_template = {
"epochs": 50,
"early_stopping": False,
"vocab_size": 20,
"reset_states": False,
# Load and preview dataset
import datetime
import pandas as pd
import numpy as np
day = 24 * 60 * 60
year = 365.2425 * day
def load_dataframe() -> pd.DataFrame:
@zredlined
zredlined / aws_lambda_sns_update_mailchimp.py
Created January 7, 2021 16:04
Barebones AWS Lambda code to update a user's tags in Mailchimp
import json
import hashlib
import urllib3
API_KEY = "[API-KEY]"
DC = "us19"
LIST_ID = "[AUDIENCE]"
TAG = 'core'
http = urllib3.PoolManager()