Skip to content

Instantly share code, notes, and snippets.

View dingusagar's full-sized avatar

Dingu Sagar dingusagar

View GitHub Profile
@dingusagar
dingusagar / rcsync.sh
Last active March 29, 2024 05:13
bashrc / zshrc Quick Sync when you login to a new machine.
#!/bin/bash -i
# What does this Script do ?
# Keep your most frequent bashrc / zshrc configs here. Now when you
# login to a new machine, instead of all the copy past hazzle, just
# run these commands to sync your bashrc/zshrc config file from here.
from transformers import ViTFeatureExtractor, ViTForImageClassification
import requests
from io import BytesIO
from PIL import Image
model_name_or_path = 'vit-base-avengers-v1'
feature_extractor = ViTFeatureExtractor.from_pretrained(model_name_or_path)
model = ViTForImageClassification.from_pretrained(model_name_or_path)
from transformers import ViTFeatureExtractor, ViTForImageClassification, Trainer, TrainingArguments
import torch
from datasets import load_dataset, load_metric
import numpy as np
DATASET_DIR = '/content/output'
dataset = load_dataset(name="avengers", path=DATASET_DIR, data_files={"train": "/content/output/train/**", "test": "/content/output/val/**"})
labels = dataset['train'].features['label'].names
@dingusagar
dingusagar / cheatsheet.cpp
Created October 19, 2018 04:29 — forked from satwikkansal/cheatsheet.cpp
C++ STL cheatsheet for competitive progrmming
/*
This a header file that includes every standard library.
You can use it to save time.
NOTE: This header file may not be recognized by compilers
other than gcc.
*/
#include <bits/stdc++.h>
#include<tuple> // support from c++11 only. use the option -std=c++11 for g++ if there is any problem
/*