This file contains hidden or 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
cmake_minimum_required(VERSION 3.10) | |
project(MonteCarloCasino) | |
set(CMAKE_CXX_STANDARD 17) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
# Set optimization flags | |
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native") | |
# Find threads package |
This file contains hidden or 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
How to quantize 70B model so it will fit on 2x4090 GPUs: | |
I tried EXL2, AutoAWQ, and SqueezeLLM and they all failed for different reasons (issues opened). | |
HQQ worked: | |
I rented a 4x GPU 1TB RAM ($19/hr) instance on runpod with 1024GB container and 1024GB workspace disk space. | |
I think you only need 2x GPU with 80GB VRAM and 512GB+ system RAM so probably overpaid. | |
Note you need to fill in the form to get access to the 70B Meta weights. |
This file contains hidden or 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
# conda create -n dbrx python=3.10 -y && conda activate dbrx | |
# pip install torch transformers tiktoken flash_attn bitsandbytes | |
from transformers import AutoTokenizer, AutoModelForCausalLM | |
import torch | |
tokenizer = AutoTokenizer.from_pretrained("SinclairSchneider/dbrx-instruct-quantization-fixed", trust_remote_code=True) | |
model = AutoModelForCausalLM.from_pretrained("SinclairSchneider/dbrx-instruct-quantization-fixed", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True, load_in_4bit=True) | |
input_text = "What does it take to build a great LLM?" |
This file contains hidden or 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
# Collaboration between Claude-3 and GPT-4 to implement https://arxiv.org/pdf/2312.02116.pdf | |
# This is just the GMM decoder part of the model they propose (which is the new thing). | |
# This one was mainly generated by GPT-4. | |
# The AIs provided two implementations of the idea and revised eachothers' code. | |
# I tested that the unit tests pass but haven't tried it in a language model yet. | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F |
This file contains hidden or 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
# Collaboration between Claude-3 and GPT-4 to implement https://arxiv.org/pdf/2312.02116.pdf | |
# This is just the GMM decoder part of the model they propose (which is the new thing). | |
# This one was mainly generated by Claude-3. | |
# The AIs provided two implementations of the idea and revised eachothers' code. | |
# I tested that the unit tests pass but haven't tried it in a language model yet. | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F |
This file contains hidden or 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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.nn.init as init | |
import math | |
#torch.autograd.set_detect_anomaly(True) | |
class FeedForward(torch.nn.Module): | |
def __init__(self, input_features, output_features): |
This file contains hidden or 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 torch | |
import torch.nn as nn | |
import torch.nn.init as init | |
import torch.nn.functional as F | |
# This layer is dropped into your pre-trained PyTorch model where nn.Linear is used | |
class DoRALayer(nn.Module): | |
def __init__(self, d_in, d_out, rank=4): | |
super().__init__() |
This file contains hidden or 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
##################################################################### | |
# Auto Z-Calibration | |
##################################################################### | |
[z_calibration] | |
probe_nozzle_x: 175.5 | |
probe_nozzle_y: 257 | |
# The X and Y coordinates (in mm) for clicking the nozzle on the | |
# Z endstop. | |
probe_switch_x: 169.3 |
This file contains hidden or 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
[gcode_macro PRINT_START] | |
gcode: | |
M117 Print Starting... | |
; Make sure we are not applying stale bed mesh or Z offset | |
SET_GCODE_OFFSET Z=0 | |
BED_MESH_CLEAR | |
; Start heating bed |
This file contains hidden or 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
[gcode_macro PRINT_START] | |
gcode: | |
M117 Print Starting... | |
; Make sure we are not applying stale bed mesh or Z offset | |
SET_GCODE_OFFSET Z=0 | |
BED_MESH_CLEAR | |
; Start heating bed |
NewerOlder