Skip to content

Instantly share code, notes, and snippets.

@lewtun
lewtun / sft_trainer.py
Last active June 19, 2024 13:48
Fine-tuning Mistral 7B with TRL & DeepSpeed ZeRO-3
# This is a modified version of TRL's `SFTTrainer` example (https://github.com/huggingface/trl/blob/main/examples/scripts/sft_trainer.py),
# adapted to run with DeepSpeed ZeRO-3 and Mistral-7B-V1.0. The settings below were run on 1 node of 8 x A100 (80GB) GPUs.
#
# Usage:
# - Install the latest transformers & accelerate versions: `pip install -U transformers accelerate`
# - Install deepspeed: `pip install deepspeed==0.9.5`
# - Install TRL from main: pip install git+https://github.com/huggingface/trl.git
# - Clone the repo: git clone github.com/huggingface/trl.git
# - Copy this Gist into trl/examples/scripts
# - Run from root of trl repo with: accelerate launch --config_file=examples/accelerate_configs/deepspeed_zero3.yaml --gradient_accumulation_steps 8 examples/scripts/sft_trainer.py
@HarshitRuwali
HarshitRuwali / obsidian-docx.md
Last active April 8, 2024 01:30
Export Obsidian/Markdown notes to docx

Firstly use obsidian-export to export the Obsidian Vault/Notes to regular markdown files.

Once after exporting in the regular markdown format use the following script to convert the markdown to docx. This will require Pandoc.

pandoc md-file.md \
-o out-docx-file.docx \
--from markdown+yaml_metadata_block+raw_html \
--top-level-division=chapter
@rossedman
rossedman / main.tf
Last active March 7, 2024 14:00
Scale homelab into cloud with Tailscale, Terraform and cloud-init
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
}
}
}
provider "digitalocean" {
}
@acundari
acundari / traefik-auth.conf
Last active December 6, 2022 09:41
Traefik fail2ban
# /etc/fail2ban/filter.d/traefik-auth.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$
@JusteLeblanc
JusteLeblanc / materialize_form_theme.html.twig
Created February 27, 2017 21:09
Symfony2 form theme to integrate Materialize in your Symfony2 forms
{% extends 'form_div_layout.html.twig' %}
{% block form_row -%}
<div class="row{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
<div class="input-field col s12">
{{- form_widget(form) -}}
{{- form_label(form) -}}
{{- form_errors(form) -}}
</div>
</div>
@jakzal
jakzal / .package.yml
Last active June 9, 2020 15:20
Build an rpm/deb package for a Symfony project
config:
packagename: symfony-demo
version: 1.0.0
arch: all
maintainer: Bob The Builder <bob@example.com>
description: Symfony demo project
url: http://symfony.com
packagetype: rpm
depends: ''
# - apache2
@mbostock
mbostock / .block
Last active May 31, 2024 14:19
Line Drawing
license: gpl-3.0
redirect: https://observablehq.com/@d3/draw-me
@gojun077
gojun077 / LFCS_study
Created March 19, 2015 05:32
LFCS Study Outline 2015.02.28
* LFCS Domains 2015.02
Note - the domains will change somewhat in March 2015. SW RAID
with mdadm will be removed
** The Command Line
*** Editing text files on the CLI
Covers the use of the basic text editors nano and gedit as well
as the advanced editors _vi_ and _emacs_
- nano
simple CLI-based text editor
@milo
milo / github-webhook-handler.php
Last active July 26, 2023 15:29
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@bendavis78
bendavis78 / gist:236fb890ba23b10e66fc
Created May 26, 2014 21:26
strapdown.js external load
<!DOCTYPE html>
<html>
<xmp id="README" theme="united" style="display:none;">
</xmp>
<script type="text/javascript">
var req = new XMLHttpRequest();
req.onload = function() {
var xmpNode = document.getElementById('README');
xmpNode.appendChild(document.createTextNode(this.responseText));
}