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 collections import defaultdict | |
import numpy as np | |
import pandas as pd | |
import torch | |
import torch.nn as nn | |
from datasets import load_dataset | |
from rich.console import Console | |
from rich.table import Table | |
from transformers import ( | |
AutoConfig, |
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 dataclasses import dataclass | |
from datasets import load_dataset | |
import llm_blender | |
from transformers import HfArgumentParser | |
import multiprocessing | |
import random | |
import itertools | |
import warnings | |
from collections import defaultdict | |
warnings.filterwarnings("ignore") |
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 collections import defaultdict | |
import numpy as np | |
import pandas as pd | |
import torch | |
import torch.nn as nn | |
from datasets import load_dataset | |
from rich.console import Console | |
from rich.table import Table | |
from transformers import ( | |
AutoConfig, |
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 transformers | |
import torch.nn.functional as F | |
tokenizer = transformers.AutoTokenizer.from_pretrained("gpt2", padding_side="right") | |
tokenizer.add_special_tokens({"pad_token": "[PAD]"}) | |
pad_id = tokenizer.pad_token_id | |
policy = transformers.AutoModelForCausalLM.from_pretrained("gpt2") | |
policy.generation_config.pad_token_id = policy.generation_config.eos_token_id |
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
# docs and experiment results can be found at https://docs.cleanrl.dev/rl-algorithms/ppo/#ppo_atari_multigpupy | |
import os | |
import random | |
import time | |
import warnings | |
from dataclasses import dataclass, field | |
from typing import List, Literal | |
import gymnasium as gym | |
import numpy as np |
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 transformers import AutoTokenizer, AutoModelForCausalLM | |
import numpy as np | |
from scipy.special import softmax | |
model_name = "hkust-nlp/deita-quality-scorer" | |
tokenizer = AutoTokenizer.from_pretrained(model_name) | |
model = AutoModelForCausalLM.from_pretrained(model_name) | |
def infer_quality(model, tokenizer, input_text, output_text): | |
quality_template = ("You are a helpful assistant. Please identify the quality score of the Response corresponding to the Question. \n #Question#:\n{instruction}\n#Response#:\n{output} \n##Quality: ") | |
user_input = quality_template.format(instruction=input_text, output=output_text) |
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
(.venv) costa@login-node-1:/fsx/costa/tgi-swarm$ python examples/benchmark.py --instances=1 --model mistralai/Mixtral-8x7B-Instruct-v0.1 | |
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used. | |
running sbatch --parsable slurm/tgi_1707320176_tgi.slurm | |
Slurm Job ID: ['1774193'] | |
📖 Slurm hosts path: slurm/tgi_1707320176_host_tgi.txt | |
✅ Done! Waiting for 1774193 to be created | |
📖 Slurm log path: slurm/logs/llm-swarm_1774193.out | |
✅ Done! Waiting for slurm/tgi_1707320176_host_tgi.txt to be created | |
obtained endpoints ['http://26.0.171.88:25145'] | |
⣽ Waiting for http://26.0.171.88:25145 to be reachable |
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 os | |
import random | |
import time | |
from collections import defaultdict | |
from dataclasses import asdict, dataclass, field | |
from types import SimpleNamespace | |
from typing import List, Literal, Optional | |
import numpy as np | |
import pandas as pd |
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 collections import defaultdict | |
import numpy as np | |
import pandas as pd | |
import torch | |
import torch.nn as nn | |
from datasets import load_dataset | |
from rich.console import Console | |
from rich.table import Table | |
from transformers import ( | |
AutoConfig, |
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 transformers | |
import torch.nn.functional as F | |
tokenizer = transformers.AutoTokenizer.from_pretrained("gpt2", padding_side="right") | |
tokenizer.add_special_tokens({"pad_token": "[PAD]"}) | |
pad_id = tokenizer.pad_token_id | |
policy = transformers.AutoModelForCausalLM.from_pretrained("gpt2") | |
policy.generation_config.pad_token_id = policy.generation_config.eos_token_id |