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
# 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 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 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 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 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 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 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 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 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
[include mainsail.cfg] | |
[include timelapse.cfg] | |
# This file contains common pin mappings for the BigTreeTech Octopus V1. | |
# To use this config, the firmware should be compiled for the STM32F446 with a "32KiB bootloader" | |
# Enable "extra low-level configuration options" and select the "12MHz crystal" as clock reference | |
# after running "make", copy the generated "klipper/out/klipper.bin" file to a | |
# file named "firmware.bin" on an SD card and then restart the OctoPus with that SD card. |
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
x264_param_t param; | |
x264_param_default_preset(¶m, "veryfast", "zerolatency"); | |
param.rc.i_rc_method = X264_RC_ABR; | |
param.rc.i_bitrate = kbps_bitrate; | |
param.i_width = width; | |
param.i_height = height; | |
param.i_fps_num = fps; | |
param.i_fps_den = 1; | |
param.i_csp = X264_CSP_I420; |
NewerOlder