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
/* | |
* GNU GENERAL PUBLIC LICENSE | |
* Version 3, 29 June 2007 | |
* | |
* Copyright (C) [2023] [Captain Vincent] | |
* Original Source: https://gist.github.com/CaptainVincent/74a15cd9d9c450e961b867f69008ee6e | |
* | |
* Everyone is permitted to copy and distribute verbatim copies of this license document, | |
* but changing it is not allowed. | |
* |
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
# stage 1: clone repo using ssh key | |
FROM ubuntu:22.04 AS clone | |
RUN apt-get update | |
RUN apt-get install -y git | |
# Add the keys and set permissions | |
ARG SSH_PRIVATE_KEY | |
RUN mkdir /root/.ssh/ | |
RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa |
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 os | |
import os.path as osp | |
import json | |
import glob | |
from prompts import * | |
import google.generativeai as genai | |
import time | |
from queue import Queue, Empty | |
from typing import Dict | |
import threading |
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 torch | |
import random | |
class RatioSampler(torch.utils.data.Sampler): | |
def __init__(self, dataset, ratio=1.0, shuffle=True): | |
self.dataset_size = len(dataset) | |
self.ratio = ratio | |
self.shuffle = shuffle | |
# Calculate the number of samples per episode |
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 torch | |
import torch.nn as nn | |
class RotaryEmbeddingPatched(nn.Module): | |
def __init__(self, dim, max_position_embeddings=2048, base=10000, device=None): | |
super().__init__() | |
self.dim = dim | |
self.max_position_embeddings = max_position_embeddings |
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
if status is-interactive | |
# Commands to run in interactive sessions can go here | |
end | |
# ================== PATH ================== | |
# set -x PATH | |
set -x AWS_ACCESS_KEY_ID wangjing01 | |
set -x AWS_SECRET_ACCESS_KEY jm2E6gBaFZvD | |
set -x TZ Asia/Singapore |
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
if status is-interactive | |
# Commands to run in interactive sessions can go here | |
end | |
# ================== PATH ================== | |
# set -x PATH | |
set -x AWS_ACCESS_KEY_ID wangjing01 | |
set -x AWS_SECRET_ACCESS_KEY jm2E6gBaFZvD | |
set -x TZ Asia/Singapore |
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
# This source code is licensed under the license found in the | |
# LICENSE file in the root directory of this source tree. | |
# -------------------------------------------------------- | |
# References: | |
# PixArt: https://github.com/PixArt-alpha/PixArt-alpha | |
# Latte: https://github.com/Vchitect/Latte | |
# DiT: https://github.com/facebookresearch/DiT/tree/main | |
# GLIDE: https://github.com/openai/glide-text2im | |
# MAE: https://github.com/facebookresearch/mae/blob/main/models_mae.py | |
# -------------------------------------------------------- |
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 selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException | |
import time | |
import random | |
import os, os.path as osp | |
import tempfile |
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 ...dist import synchronize, get_rank | |
ignored = False | |
def ddp_synchronize_trace(frame, event, arg): | |
if event == "line" and not ignored: | |
synchronize() | |
return ddp_synchronize_trace |
NewerOlder