Skip to content

Instantly share code, notes, and snippets.

with open("events.log", "r") as file:
content = file.read()
command_key = "Command"
shift_key = "Shift"
control_key = "Control"
@sert121
sert121 / graphrouter_v0.py
Last active March 17, 2025 02:19
A simplified implementation of the GraphRouter paper
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
import logging
from datasets import load_dataset
from transformers import AutoTokenizer, AutoModel
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
@sert121
sert121 / finetune_orpo.py
Last active July 10, 2024 07:51
Finetune a llama model using ORPO
# Copyright 2024 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
import cv2, sys
cap = cv2.VideoCapture(0)
cv2.namedWindow('Frame', cv2.WINDOW_NORMAL)
# Our ROI, defined by two points
p1, p2 = None, None
state = 0
# Called every time a mouse event happen