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 time | |
from typing import Any, Dict, Literal | |
from distilabel.llms import vLLM | |
from distilabel.llms.typing import ChatType | |
from distilabel.pipeline import Pipeline | |
from distilabel.steps import LoadDataFromDicts | |
from distilabel.steps.tasks.prometheus_eval import PrometheusEval | |
_CUSTOM_RUBRICS = { |
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
# 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 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 distilabel.llms import ( | |
AnthropicLLM, | |
InferenceEndpointsLLM, | |
OpenAILLM, | |
) | |
from distilabel.pipeline import Pipeline | |
from distilabel.steps import ( | |
CombineColumns, | |
KeepColumns, | |
LoadDataFromDicts, |
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
# Usage: | |
# python steps-unpacked-constant-length-dataset.py \ | |
# --dataset-path "argilla/ultrafeedback-binarized-preferences-cleaned" \ | |
# --hf-tokenizer "alignment-handbook/zephyr-7b-sft-full" \ | |
# --gradient-accumulation-steps 2 \ | |
# --per-eval-batch-size 32 \ | |
# --num-devices 8 \ | |
# --max-seq-length 2048 \ | |
# --num-of-sequences 1024 \ | |
# --chars-per-token 3.6 |
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
# Usage: python upload.py --dir <dir> --hub-name <hub_name> | |
from transformers import AutoModelForCausalLM, AutoTokenizer | |
import torch | |
import argparse | |
def get_args(): | |
parser = argparse.ArgumentParser() |
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 | |
from datasets import load_dataset | |
from peft import LoraConfig, get_peft_model | |
from transformers import AutoTokenizer, AutoModelForCausalLM | |
from trl import DPOTrainer | |
if __name__ == "__main__": | |
model_name = "..." | |
dataset = load_dataset(...) |
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
# Copyright 2020 Alvaro Bartolome @ alvarobartt in GitHub | |
# ____ ___ ___ ______ ______ ____ ___ ___ ___ _____ ___ ____ ___ | |
# / || | || | | || || | | / _]| | / \ | \ / _] | |
# | __|| _ _ || | | | | | | _ _ | / [_ |__/ || || _ | / [_ | |
# | | || \_/ ||_| |_| |_| |_| | | | \_/ || _]| __|| O || | || _] | |
# | |_ || | | | | | | | | | | || [_ | / || || | || [_ | |
# | || | | | | | | | | | | || || || || | || | | |
# |___,_||___|___| |__| |__| |____||___|___||_____||_____| \___/ |__|__||_____| | |
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
# Required investpy version 0.9.10 or higher (0.9.12 recommended) | |
import investpy | |
# As asked on issue #86 -> https://github.com/alvarob96/investpy/issues/86 | |
# this gist will explain `investpy.search_text` function usage for Swedish | |
# bonds that are not statically stored on investpy/resources/bonds/bonds.csv | |
# file, since its data is not provided by Investing on its general government | |
# bonds listing. | |
search_results = investpy.search_text(text='Sweden 10 Year', count=10) |
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 investpy | |
print(investpy.__author__, investpy.__version__) | |
# Retrieve a `pandas.DataFrame` containing all the Stocks from United States | |
stocks = investpy.get_stocks(country='united states') | |
# Retrieve historical data from AAPL | |
df = investpy.get_stock_historical_data(stock='AAPL', # Stock symbol of the stock to retrieve data from | |
country='united states', # Country from where the introduced stock is from |
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 trendet | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set(style='darkgrid') | |
df = identify_all_trends(equity='bbva', | |
country='spain', | |
from_date='01/01/2018', |
NewerOlder