Skip to content

Instantly share code, notes, and snippets.

View naoto0804's full-sized avatar

Naoto Inoue naoto0804

View GitHub Profile
# 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 (
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
@naoto0804
naoto0804 / layoutgpt.py
Last active May 31, 2023 10:08
LayoutGPT
# 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
import gc
import os
import numpy as np
import psutil
import tensorflow as tf
from tensorflow.keras.layers import (
Activation,
BatchNormalization,
Conv2D,
#!/bin/sh
PACKAGE=$1
pip download $PACKAGE -d /tmp --no-binary :all:-v 2>&1 \
| grep Collecting \
| cut -d' ' -f2 \
| grep -Ev "$PACKAGE(~|=|\!|>|<|$)"