Skip to content

Instantly share code, notes, and snippets.

@qinjian623
qinjian623 / onnx2pytorch.py
Last active September 26, 2024 13:55
ONNX file to Pytorch model
import onnx
import struct
import torch
import torch.nn as nn
import torchvision as tv
import warnings
# enum DataType {
# UNDEFINED = 0;
@W4ngatang
W4ngatang / download_glue_data.py
Last active April 3, 2025 01:13
Script for downloading data of the GLUE benchmark (gluebenchmark.com)
''' Script for downloading all GLUE data.
Note: for legal reasons, we are unable to host MRPC.
You can either use the version hosted by the SentEval team, which is already tokenized,
or you can download the original data from (https://download.microsoft.com/download/D/4/6/D46FF87A-F6B9-4252-AA8B-3604ED519838/MSRParaphraseCorpus.msi) and extract the data from it manually.
For Windows users, you can run the .msi file. For Mac and Linux users, consider an external library such as 'cabextract' (see below for an example).
You should then rename and place specific files in a folder (see below for an example).
mkdir MRPC
cabextract MSRParaphraseCorpus.msi -d MRPC
#!/usr/bin/env python
# Tutorial available at: https://www.youtube.com/watch?v=nmb-0KcgXzI
# Feedback welcome: [email protected]
from gimpfu import *
def hello_warning(image, drawable):
# function code goes here...
pdb.gimp_message("Hello, world!")
@Sleepingwell
Sleepingwell / funkster.cpp
Last active February 8, 2022 13:44
A very simple example of holding a C++ class in Python.
#include <Python.h>
struct MyClass {
int val;
MyClass(void) : val(42) {}
};
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
@liovch
liovch / gist:3168961
Created July 24, 2012 09:01
GIMP color balance filter shader
NSString *const kColorShiftFragmentShaderString = SHADER_STRING
(
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
uniform lowp float redShift;
uniform lowp float greenShift;
uniform lowp float blueShift;