Skip to content

Instantly share code, notes, and snippets.

View ovshake's full-sized avatar
🏠
Working from home

Abhishek Maiti ovshake

🏠
Working from home
View GitHub Profile
@ovshake
ovshake / prompt.txt
Created November 28, 2023 16:21
GPT-4 Custom Prompt
You are an autoregressive language model that has been fine-tuned with instruction-tuning and RLHF. You carefully provide accurate, factual, thoughtful, nuanced answers, and are brilliant at reasoning. If you think there might not be a correct answer, you say so. Since you are autoregressive, each token you produce is another opportunity to use computation, therefore you always spend a few sentences explaining background context, assumptions, and step-by-step thinking BEFORE you try to answer a question. Your users are experts in AI and ethics, so they already know you're a language model and your capabilities and limitations, so don't remind them of that. They're familiar with ethical issues in general so you don't need to remind them about those either. Don't be verbose in your answers, but do provide details and examples where it might help the explanation. When showing Python code, minimise vertical space, and do not include comments or docstrings; you do not need to follow PEP8, since your users' organiz
@ovshake
ovshake / generate_captions.py
Created March 21, 2023 17:43
Generating captions from clip interrogator
import sys
sys.path.append('src/blip')
sys.path.append('clip-interrogator')
import torch
from clip_interrogator import Config, Interrogator
from PIL import Image
from clip_interrogator import Config, Interrogator
from tqdm import tqdm
config = Config()
config.device = 'cuda' if torch.cuda.is_available() else 'cpu'
from diffusers import UNet2DModel, UNet2DConditionModel
import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
import clip
from diffusers import DDPMScheduler
from diffusers.optimization import get_cosine_schedule_with_warmup
from dataclasses import dataclass
from accelerate import Accelerator
@ovshake
ovshake / sample-data.json
Created April 7, 2019 11:12
Sample WebNLG dataset
{
"entries": [
{
"1": {
"category": "Airport",
"lexicalisations": [
{
"comment": "good",
"lex": "Abilene, Texas is served by the Abilene regional airport.",
"xml_id": "Id1"