Skip to content

Instantly share code, notes, and snippets.

import torch
from diffusers import StableDiffusionPipeline
access_token = "<access token>"
# make sure you're logged in with `huggingface-cli login`
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", revision="fp16", torch_dtype=torch.float16, use_auth_token=access_token)
pipe = pipe.to("cuda")
@Arkoniak
Arkoniak / gist:23cf0f89ef66d70680e217672a6dc994
Created February 22, 2022 18:52
CFP JuliaCon 2022 (RU)
Принятие заявок (CFP) на JuliaCon 2022 открыто: https://t.co/T9LrFCVJfH
Если вы хотите выступить с докладом или виртуальным постером, провести минисимпозиум, практикум или
просто поделиться опытом, то обязательно перейдите по ссылке выше!
#JuliaLang #JuliaCon
@Arkoniak
Arkoniak / task_cancellation.jl
Created August 2, 2021 17:59
Multiple async tasks cancellation
function foo()
ts = Task[]
begin
for i in 1:20
t = @task begin
sleep(i/10)
println(i)
@assert i != 5
end
push!(ts, t)
@Arkoniak
Arkoniak / csv_datapipes_example.jl
Last active June 10, 2021 08:10
Example of interop between CSV.jl and DataPipes.jl
using CSV
using DataPipes
using SplitApplyCombine
csv = """
x,y,z
1,3,5
1,2,4
2,4,1
"""
@Arkoniak
Arkoniak / data.txt
Created March 2, 2021 15:56
Data for test_view2.jl
0.19345484517173928
0.11384864375977188
0.1844963245314597
0.11030110979110863
0.6292936087454175
0.11452167250127743
0.06513420967099504
0.9024443886795332
0.19154452909475705
0.34650274437026796
@Arkoniak
Arkoniak / test_view2.jl
Created March 2, 2021 15:53
File for testing view speed
function f1(v)
v1 = deepcopy(v)
stats = @timed sort!(v1)
return stats.time*1.0e6
end
function f2(v)
v1 = deepcopy(v)
v2 = @views v1[500:1499]
stats = @timed sort!(v2)
@Arkoniak
Arkoniak / nbabel_threads.jl
Last active December 14, 2020 11:10
Threaded version of nbabel
"""
This is an implementation of the NBabel N-body problem.
See nbabel.org for more information.
This is 'naive & native' Julia with type and loop annotations for
fastmath and vectorization, because this is really is no effort.
Without annotations the code will be as slow as naive Python/IDL.
include("nbabel.jl")
@Arkoniak
Arkoniak / nbabel2_simd.jl
Last active December 14, 2020 10:00
NBabel with 4th dimension for simd calculations.
"""
This is an implementation of the NBabel N-body problem.
See nbabel.org for more information.
This is 'naive & native' Julia with type and loop annotations for
fastmath and vectorization, because this is really is no effort.
Without annotations the code will be as slow as naive Python/IDL.
include("nbabel.jl")
@Arkoniak
Arkoniak / nbabel_updated.jl
Created December 12, 2020 16:00
NBabel calculations accelerated
"""
This is an implementation of the NBabel N-body problem.
See nbabel.org for more information.
This is 'naive & native' Julia with type and loop annotations for
fastmath and vectorization, because this is really is no effort.
Without annotations the code will be as slow as naive Python/IDL.
include("nbabel.jl")
@Arkoniak
Arkoniak / aoc_day01_data_generation.jl
Created December 1, 2020 16:01
Advent of Code, day 01, data generation
using StableRNGs
function validate2(res, n)
cnt = 0
for i in res
for j in res
cnt += (i != j) & (i + j == n)
end
end
cnt == 2