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
| # train_grpo.py | |
| # | |
| # See https://github.com/willccbb/verifiers for ongoing developments | |
| # | |
| """ | |
| citation: | |
| @misc{brown2025grpodemo, | |
| title={Granular Format Rewards for Eliciting Mathematical Reasoning Capabilities in Small Language Models}, | |
| author={Brown, William}, |
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 triton | |
| import triton.language as tl | |
| def unpack_weights(packed: torch.Tensor, bits: int = 2) -> torch.Tensor: | |
| values_per_item = 8 // bits | |
| packed_shape = packed.shape | |
| if len(packed_shape) == 1: |
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
| # pip install "distilabel[vllm]>=1.1.1" | |
| # pip install flash-attn --no-build-isolation | |
| # huggingface-cli login | |
| import time | |
| from distilabel.llms import vLLM | |
| from distilabel.pipeline import Pipeline | |
| from distilabel.steps import KeepColumns, LoadHubDataset | |
| from distilabel.steps.tasks import PrometheusEval |
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
| // npm i express axios && node ./oailogger.js | |
| const express = require('express'); | |
| const axios = require('axios'); | |
| const bodyParser = require('body-parser'); | |
| const stream = require('stream'); | |
| const { promisify } = require('util'); | |
| const fs = require('fs'); | |
| const logStream = fs.createWriteStream('logs.jsonl', { flags: 'a' }); | |
| const app = express(); |
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 json | |
| import argparse | |
| from transformers import MistralConfig, AutoModelForCausalLM | |
| import torch | |
| import sys | |
| import os | |
| def calculate_model_parameters(config): | |
| # Load the model configuration from the JSON file | |
| # Extract the necessary values from the configuration |
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
| """ | |
| The code below combines approaches published by both @eugene-yh and @jinyongyoo on Github. | |
| Thanks for the contributions guys! | |
| """ | |
| import torch | |
| import peft |
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 time | |
| from contextlib import suppress | |
| import torch | |
| import torch.nn as nn | |
| import torch.optim as optim | |
| import torch.nn.functional as F | |
| import torch.backends.cuda as cuda | |
| from torch.utils.data import DataLoader, IterableDataset |
Steps:
- wget https://gist.github.com/rom1504/67ada3dedbecc113ae2dbdfd9c642d83/raw/865fb35e00f21330b5b82aeb7c31941b6c18f649/spark_on_slurm.sh
- wget https://gist.github.com/rom1504/67ada3dedbecc113ae2dbdfd9c642d83/raw/865fb35e00f21330b5b82aeb7c31941b6c18f649/worker_spark_on_slurm.sh
- wget https://archive.apache.org/dist/spark/spark-3.3.1/spark-3.3.1-bin-hadoop3.tgz && tar xf spark-3.3.1-bin-hadoop3.tgz
- sbatch spark_on_slurm.sh
- build a venv, install pyspark, then run something like this:
(you can get https://huggingface.co/datasets/laion/laion-coco/resolve/main/part-00000-2256f782-126f-4dc6-b9c6-e6757637749d-c000.snappy.parquet as an example parquet)
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
| #!/usr/bin/env python3 | |
| # This error is caused by using `paramiko.RSA()` to manually load an ecdsa key from your know_hosts file or for manually loading as bytes. | |
| # Using: `key = paramiko.AgentKey()` instead seemingly detects the key type automatically and accepts the ecdsa-sha2-nistp256 key just fine. | |
| # EXAMPLE: | |
| import pysftp | |
| from base64 import decodebytes | |
| import paramiko |
NewerOlder