Skip to content

Instantly share code, notes, and snippets.

View FredrikNoren's full-sized avatar

Fredrik Norén FredrikNoren

View GitHub Profile
import io
import json
from typing import Any, cast
import requests
from transformers import AutoProcessor, Gemma3ForConditionalGeneration
from transformers import TrainingArguments
from trl import SFTTrainer, SFTConfig
from peft.tuners.lora.config import LoraConfig
from datasets import IterableDataset, Features
import datasets
Client code:
let mut buff = [0; 65000];
log::info!("Handshaking");
let (mut send, mut recv) = connection.connection.open_bi().await.unwrap();
send.write_all(b"hello").await.unwrap();
recv.read(&mut buff).await.unwrap(); // Discard hello message
log::info!("Synchronizing time");
let time = Instant::now();
use tokio::{runtime::Builder, sync::{mpsc}};
use winit::{event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, window::{Window, WindowBuilder}};
pub struct Gpu {
pub surface: wgpu::Surface,
pub device: wgpu::Device,
pub queue: wgpu::Queue,
pub sc_desc: wgpu::SwapChainDescriptor,
pub swap_chain: wgpu::SwapChain,
extern crate log;
extern crate futures;
extern crate deno_core;
extern crate tokio;
use deno_core::serde_json;
use deno_core::CoreIsolate;
use deno_core::CoreIsolateState;
use deno_core::ErrBox;
use deno_core::Script;
export function mutateAbilitySlots(abilitySlotsSize: number, maxColorAttachements: number) {
return multilayerShaderSource(maxColorAttachements,
`
uniform sampler2DArray cellProperties;
uniform sampler2D cleanCopyMove;
uniform float noiseSeedModify;
uniform float noiseSeedAmount;
uniform float mutateChance;
float flowEffect(vec2 texcoord, sampler2DArray source, int sourceLayer, int groundLayer, vec2 texelSize, float amount) {
float v0 = texture(source, vec3(texcoord + vec2(-texelSize.x, -texelSize.y), sourceLayer)).r;
float v1 = texture(source, vec3(texcoord + vec2(0, -texelSize.y), sourceLayer)).r;
float v2 = texture(source, vec3(texcoord + vec2(texelSize.x, -texelSize.y), sourceLayer)).r;
float v3 = texture(source, vec3(texcoord + vec2(-texelSize.x, 0), sourceLayer)).r;
float v4 = texture(source, vec3(texcoord + vec2(0, 0), sourceLayer)).r;
float v5 = texture(source, vec3(texcoord + vec2(texelSize.x, 0), sourceLayer)).r;
float v6 = texture(source, vec3(texcoord + vec2(-texelSize.x, texelSize.y), sourceLayer)).r;
import * as React from 'react';
export interface MeasureSizeProps {
onResize?: (size: number[]) => void;
}
export class MeasureSize extends React.Component<MeasureSizeProps, null> {
componentDidMount() {
this.dispatchResize();
}