Skip to content

Instantly share code, notes, and snippets.

@alvarobartt
alvarobartt / dpo-qlora-4bit.py
Last active April 25, 2024 09:42
DPO fine-tuning using `trl.DPOTrainer` and Q-LoRA (4-bit)
import torch
from datasets import load_dataset
from peft import LoraConfig, get_peft_model
from transformers import AutoTokenizer, AutoModelForCausalLM
from trl import DPOTrainer
if __name__ == "__main__":
model_name = "..."
dataset = load_dataset(...)
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@Hertzole
Hertzole / SceneObject.cs
Last active April 25, 2024 09:39
Unity scene object to easily assign scenes in the inspector.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[System.Serializable]
public class SceneObject
{
[SerializeField]
private string m_SceneName;
@Farrukhw
Farrukhw / ChocoletyInstall.ps1
Last active April 25, 2024 09:38
Powershell scripts
# The array, holding the names of the Chocolatey Packages from https://community.chocolatey.org/packages.
# 'nginx', 'openjdk','microsoft-edge'
$Packages = 'nodejs','openjdk11','python','postgresql','openssh','openssl','git','tortoisegit','freecommander-xe.install','vscode','notepadplusplus','Everything','7zip', 'grepwin','winmerge','conemu',
#check if Chocolatey is installed or not
$ChocoVersion=Invoke-Expression 'choco -v'
@Vrekrer
Vrekrer / QThreadDecorators.py
Last active April 25, 2024 09:39
Easy QT threading using python decorators.
# -*- coding: utf-8 -*-
from PyQt4 import QtCore
from functools import wraps
class Exception_StopQThread(Exception):
pass
class Runnable(QtCore.QRunnable):
def __init__(self, func, args, kwargs):
@ArvidSilverlock
ArvidSilverlock / extendedbuffer.lua
Last active April 25, 2024 09:38
Possibly useful `read` and `write` functions for `buffer`s that aren't inluded in the normal API
--[[
Copyright 2024 Arvid
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (theSoftware”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDEDAS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR T
@lelegard
lelegard / win-home-gpedit.md
Last active April 25, 2024 09:38
Enabling the Group Policy Editor on Windows 10 Home

Enabling the Group Policy Editor on Windows 10 Home

On Windows 10 Home edition, there is no Local Group Policy Editor (gpedit.msc) and no Local Security Policy Editor (secpol.msc). These tools are reserved to Professional editions of Windows.

It is however possible to install them on Windows 10 Home if you need them.

Open a PowerShell window as administrator and run the following command:

@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@luistojal93
luistojal93 / wp-query.php
Created April 25, 2024 09:36 — forked from Lego2012/wp-query.php
WP_Query #wordpress
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/