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
# https://colab.research.google.com/drive/1rm3AGquGEYXfeeizE40bbDtcWh5S4Nlq?usp=sharing#scrollTo=Fvls13onNTBl | |
# TODO: deepspeed support? | |
import random | |
from dataclasses import dataclass, field | |
import torch | |
from datasets import load_dataset | |
from peft import LoraConfig | |
from transformers import ( |
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 math | |
from svgpathtools import parse_path, Path | |
def is_svg_path_rectangle(pathdef: str) -> bool: | |
""" | |
Check if the path is | |
- closed | |
- rectangle | |
- parallel to x/y-axis |
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
# Tried to play with the following paper | |
# LayoutGPT: Compositional Visual Planning and Generation with Large Language Models | |
# https://arxiv.org/abs/2305.15393 | |
from typing import List, NamedTuple | |
from transformers import pipeline | |
RESOLUTION = 64 | |
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 gc | |
import os | |
import numpy as np | |
import psutil | |
import tensorflow as tf | |
from tensorflow.keras.layers import ( | |
Activation, | |
BatchNormalization, | |
Conv2D, |
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
#!/bin/sh | |
PACKAGE=$1 | |
pip download $PACKAGE -d /tmp --no-binary :all:-v 2>&1 \ | |
| grep Collecting \ | |
| cut -d' ' -f2 \ | |
| grep -Ev "$PACKAGE(~|=|\!|>|<|$)" |