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
prompt = f""" | |
Compare the quality of the following two instruction-response pairs: | |
Version 1 ({version1_name}): | |
Instruction: {version1['instruction']} | |
Context: {version1['context']} | |
Response: {version1['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
CUDA_VISIBLE_DEVICES=0 python train.py | |
--gpu_ids 0 --dataroot ./datasets/ebike_data | |
--name locations_FastCUT --CUT_mode FastCUT --n_epochs 30 |
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
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]) | |
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
# 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) |
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
# 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, |
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
def trends_only(source_df: pd.DataFrame, trend_col: str) -> (float, pd.DataFrame): | |
""" Extract trends as training features vs total volume """ | |
df = source_df.copy() | |
start_val = df.at[0, trend_col] | |
df.sin = df[[trend_col]].diff() | |
df.at[0, trend_col] = 0.00 | |
return start_val, df | |
def restore_daily(source_df: pd.DataFrame, start_val: float, trend_col: str): |
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
# 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: |
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
#!/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 |
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
#!/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 |
NewerOlder