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 peft | |
| import json | |
| import shutil | |
| from peft.utils import _get_submodules | |
| import os | |
| import bitsandbytes as bnb | |
| from bitsandbytes.functional import dequantize_4bit | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, LlamaForCausalLM, LlamaTokenizer, BitsAndBytesConfig, CodeLlamaTokenizer |
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
| MONGODB_URL=mongodb://localhost:27017 | |
| HF_ACCESS_TOKEN=<REDACTED> | |
| # 'name', 'userMessageToken', 'assistantMessageToken' are required | |
| MODELS=`[ | |
| { | |
| "endpoints": [{"url": "http://localhost:8081"}], | |
| "name": "WizardLM/WizardLM-70B-V1.0", | |
| "description": "WizardLM: Empowering Large Pre-Trained Language Models to Follow Complex Instructions", | |
| "websiteUrl": "https://huggingface.co/WizardLM/WizardLM-70B-V1.0", |
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 transformers import ( | |
| AutoConfig, | |
| AutoTokenizer, | |
| BitsAndBytesConfig, | |
| GenerationConfig, | |
| AutoModelForCausalLM, | |
| LlamaTokenizerFast, | |
| PreTrainedModel, | |
| TextIteratorStreamer, | |
| StoppingCriteria, |
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
| # coding=utf-8 | |
| # Copyright 2023 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 |
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 transformers | |
| import argparse | |
| import numpy as np | |
| import pandas as pd | |
| from huggingface_hub import HfFolder | |
| from datasets import load_dataset, Dataset, load_metric, concatenate_datasets, DatasetDict | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| from transformers import DataCollatorForLanguageModeling, TrainingArguments, Trainer |
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
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
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 bisect | |
| import itertools | |
| import operator | |
| class _BNode(object): | |
| __slots__ = ["tree", "contents", "children"] | |
| def __init__(self, tree, contents=None, children=None): | |
| self.tree = tree |