See: Masterminds of Programming: Conversations with the Creators of Major Programming Languages, Lua chapter.
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
# Improving Sample Quality of Diffusion Models Using Self-Attention Guidance | |
# https://arxiv.org/abs/2210.00939 | |
# https://github.com/SusungHong/Self-Attention-Guidance | |
# (1) Install (see also https://github.com/finegrain-ai/refiners#install) | |
git clone https://github.com/finegrain-ai/refiners.git | |
cd refiners | |
poetry install --all-extras | |
poetry run pip install --upgrade torch torchvision |
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
# T2I-Adapter: Learning Adapters to Dig out More Controllable Ability for Text-to-Image Diffusion Models | |
# https://github.com/TencentARC/T2I-Adapter | |
# https://huggingface.co/blog/t2i-sdxl-adapters | |
# (1) Install (see also https://github.com/finegrain-ai/refiners#install) | |
git clone https://github.com/finegrain-ai/refiners.git | |
cd refiners | |
poetry install --all-extras | |
poetry run pip install --upgrade torch torchvision |
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
# IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models | |
# https://github.com/tencent-ailab/IP-Adapter | |
# (1) Install (see also https://github.com/finegrain-ai/refiners#install) | |
git clone https://github.com/finegrain-ai/refiners.git | |
cd refiners | |
poetry install --all-extras | |
poetry run pip install --upgrade torch torchvision | |
# (2) Convert weights into Refiners format |
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
# Example: to run `torchtest.topK` do | |
luajit -ltorch -e "torch.test('topK')" |
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
# e.g. with lsqlite3 | |
# | |
# see https://github.com/keplerproject/luarocks/blob/7a7c124/src/luarocks/deps.lua#L522-L529 | |
luarocks SQLITE_INCDIR=/usr/local/opt/sqlite/include SQLITE_LIBDIR=/usr/local/opt/sqlite/lib install lsqlite3 |
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
#include <stdio.h> | |
#include <curl/curl.h> | |
int | |
main(void) | |
{ | |
curl_version_info_data *info = curl_version_info(CURLVERSION_NOW); | |
printf("async DNS: %d\n", !!(info->features & CURL_VERSION_ASYNCHDNS)); | |
return 0; | |
} |
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
require 'torch' | |
local argcheck = require 'argcheck' | |
local env = require 'argcheck.env' | |
function env.istype(obj, typename) | |
if typename == 'torch.Tensor' then | |
-- could also check the storage type! | |
return torch.isTensor(obj) | |
else |
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
require 'torch' | |
-- pre-req: luarocks install csv | |
local csv = require "csv" | |
local inputs, labels = {}, {} | |
local f, i = csv.open("data.csv"), 0 | |
for fields in f:lines() do | |
if i > 0 then -- skip header | |
inputs[i] = {unpack(fields, 1, 18)} |
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
# http://stedolan.github.io/jq/ | |
json='{"foo": {"genre":"deep house"}, "bar": {"genre": "progressive house"}, "baz": {"genre": "dubstep"}}' | |
echo "$json" | jq '[to_entries | .[] | select(.value.genre | contains("house"))] | from_entries' | |
# { | |
# "bar": { | |
# "genre": "progressive house" | |
# }, | |
# "foo": { | |
# "genre": "deep house" |
NewerOlder