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 vllm import LLM, SamplingParams | |
| from vllm.outputs import PoolingRequestOutput, RequestOutput | |
| from typing import Union | |
| import threading | |
| from threading import Event | |
| class MyLLM(LLM): | |
| def keep_running( | |
| self, |
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
| # Copyright 2023 Mistral AI and The HuggingFace Inc. team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tiktoken | |
| import langdetect | |
| T = tiktoken.get_encoding("o200k_base") | |
| length_dict = {} | |
| for i in range(T.n_vocab): | |
| try: | |
| length_dict[i] = len(T.decode([i])) | |
| except: |
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
| from collections import defaultdict | |
| import random | |
| from huggingface_hub import hf_hub_download | |
| from datasets import Dataset | |
| import numpy as np | |
| import pandas as pd | |
| from transformers import AutoTokenizer | |
| from rich.console import Console | |
| from rich.table import Table | |
| from trl import DPOTrainer |
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 argparse | |
| import math | |
| # Helper function to pretty-print message sizes | |
| def convert_params(params): | |
| if params == 0: | |
| return "0" | |
| size_name = ("", "K", "M", "B", "T", "P", "E", "Z", "Y") | |
| i = int(math.floor(math.log(params, 1000))) | |
| p = math.pow(1000, i) |
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
| from torch.utils.data import DataLoader | |
| import math | |
| from sentence_transformers import models, losses | |
| from sentence_transformers import SentencesDataset, LoggingHandler, SentenceTransformer, util, InputExample | |
| from sentence_transformers.evaluation import EmbeddingSimilarityEvaluator, SimilarityFunction | |
| import logging | |
| from datetime import datetime | |
| import sys | |
| import os | |
| import gzip |
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
| library(shiny) | |
| library(htmltools) | |
| library(rhandsontable) | |
| library(dplyr) | |
| rht <- rhandsontable( | |
| head(mtcars) %>% | |
| mutate(name = rownames(.)) %>% | |
| select(name, everything()), | |
| rowHeaders = NULL |
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
| library(rayrender) | |
| #Create base scene | |
| basescene = xz_rect(x=555/2,y=0.1,z=555/2,555,555, | |
| material = lambertian(color="#bababa", checkercolor = "grey10", checkerperiod = 100)) %>% | |
| add_object(xz_rect(x=555/2,y=1000,z=555/2,343,332, | |
| material = lambertian(color="white", lightintensity=40,implicit_sample = TRUE), | |
| flipped=TRUE)) | |
| #Function for sphere bouncing |
NewerOlder