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
import sys | |
import torch | |
device = "cuda" | |
""" | |
from transformers import GPT2LMHeadModel, GPT2TokenizerFast | |
model_id = "gpt2-large" | |
model = GPT2LMHeadModel.from_pretrained(model_id).to(device) | |
tokenizer = GPT2TokenizerFast.from_pretrained(model_id) |
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
import sqlite3 | |
from flask import Flask, jsonify, request | |
app = Flask(__name__) | |
# Connect to the database | |
conn = sqlite3.connect("twitter.db") | |
cursor = conn.cursor() | |
# Create the tweets table if it doesn't already exist |
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
float sdPlane( vec3 p ) { | |
return p.y; | |
} | |
float sdSphere( in vec3 p, in vec4 s ) { | |
return length(p-s.xyz) - s.w; | |
} | |
float sdBox( vec3 p, vec3 b ) | |
{ |
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
#!/usr/bin/python | |
import math | |
import numpy | |
import subprocess | |
from scipy.optimize import fmin_cg | |
bestv = 9999999 | |
def sferror(x): |
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
use std::str; | |
pub struct S2<'self> { | |
priv iter: std::str::StrCharIterator<'self>, | |
} |
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
#!/usr/bin/python | |
import time | |
import sh | |
import sys | |
from multiprocessing import Pool | |
def get_fens(): | |
with open('pgn_fen') as f: | |
next = False | |
for line in f.read().split('\n'): |
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
Script ./clop-cutechess-cli.py | |
Name BishopPin | |
IntegerParameter pin_open -100 100 | |
IntegerParameter pin_end -100 100 | |
Processor machine1 | |
Processor machine2 | |
Processor machine3 | |
Replications 2 | |
DrawElo 100 |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
Usage: clop-cutechess-cli.py CPU_ID SEED [PARAM_NAME PARAM_VALUE]... | |
Run cutechess-cli with CLOP_PARAM(s). | |
CPU_ID Symbolic name of the CPU or machine that should run the game | |
SEED Running number for the game to be played | |
PARAM_NAME Name of a parameter that's being optimized |
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
#!/usr/bin/python | |
import math | |
def los(n1, n0): | |
pi = [1.0] * (n1 + 3) | |
pi[0] = 0 | |
for j in xrange(n0 + 1, 0, -1): | |
for i in xrange(0, n1 + 1): | |
pi[i + 1] = (pi[i + 1] + pi[i]) * 0.5 |