This file contains 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
""" | |
# Stable Diffusion Embedding Converter | |
This is a simple script that converts a `.pt` Textual Inversion embedding file to `.safetensors` format. Nothing more, nothing less. | |
## To Use | |
``` | |
$ python convert_embedding.py embeddings/myembed.pt embeddings/myembed.safetensors |
This file contains 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
const path = require('path'); | |
// this is the key function where all the magic happens | |
function getSubclassDir() { | |
// override prepareStackTrace | |
// error.stack will be <CallSite>[] rather than <string> | |
const original = Error.prepareStackTrace; | |
Error.prepareStackTrace = function(err, stack) { return stack; }; | |
// create a new error and use the stack |
This file contains 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
function getCanonicalJSON(obj) { | |
if(typeof obj === 'object') { | |
var keys = []; | |
// get keys and sort them | |
for(var k in obj) keys.push(k); | |
keys.sort(); | |
// append each kvp to string | |
return '{' + keys.reduce(function(prev, cur, i) { | |
return prev + (i>0?',':'') + '"' + cur + '":' + getCanonicalJSON(obj[cur]); |
This file contains 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
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
// this could be stored in a json file instead | |
var mimetypes = { | |
css: "text/css", | |
gif: "image/gif", |
This file contains 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
/********************************************************************** | |
mergeCSV.js - Merge similar CSVs | |
*********************************************************************** | |
Copyright (C) 2015 D. Oliver Brown <unidyne AT gmail.com> | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to |