|
|
|
import os |
|
import gradio as gr |
|
|
|
import wandb |
|
from huggingface_hub import HfApi |
|
|
|
TOKEN = os.environ.get("DATACOMP_TOKEN") |
|
API = HfApi(token=TOKEN) |
|
wandb_api_key = os.environ.get('wandb_api_key') |
|
wandb.login(key=wandb_api_key) |
|
|
|
random_num = f"50.0" |
|
subset = f"frac-1over8" |
|
experiment_name = f"ImageNetTraining50.0-frac-1over8" |
|
experiment_repo = f"datacomp/ImageNetTraining50.0-frac-1over8" |
|
|
|
def start_train(): |
|
os.system("echo '#### pwd'") |
|
os.system("pwd") |
|
os.system("echo '#### ls'") |
|
os.system("ls") |
|
|
|
os.system("echo 'Creating results output repository in case it does not exist yet...'") |
|
try: |
|
API.create_repo(repo_id=f"datacomp/ImageNetTraining50.0-frac-1over8", repo_type="dataset",) |
|
os.system(f"echo 'Created results output repository datacomp/ImageNetTraining50.0-frac-1over8'") |
|
except: |
|
os.system("echo 'Already there; skipping.'") |
|
pass |
|
os.system("echo 'Beginning processing.'") |
|
|
|
os.system(f"export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True") |
|
os.system("echo 'Okay, trying training.'") |
|
os.system(f"cd pytorch-image-models; ./train.sh 4 --dataset hfds/datacomp/imagenet-1k-random-50.0-frac-1over8 --log-wandb --wandb-project ImageNetTraining50.0-frac-1over8 --experiment ImageNetTraining50.0-frac-1over8 --model seresnet34 --sched cosine --epochs 150 --warmup-epochs 5 --lr 0.4 --reprob 0.5 --remode pixel --batch-size 256 --amp -j 4") |
|
os.system("echo 'Done'.") |
|
os.system("ls") |
|
|
|
os.system("echo 'trying to upload...'") |
|
API.upload_folder(folder_path="/app", repo_id=f"datacomp/ImageNetTraining50.0-frac-1over8", repo_type="dataset",) |
|
API.pause_space(experiment_repo) |
|
|
|
def run(): |
|
with gr.Blocks() as app: |
|
gr.Markdown(f"Randomization: 50.0") |
|
gr.Markdown(f"Subset: frac-1over8") |
|
start = gr.Button("Start") |
|
start.click(start_train) |
|
app.launch(server_name="0.0.0.0", server_port=7860) |
|
|
|
if __name__ == '__main__': |
|
run() |
|
|