mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2026-04-04 14:17:28 +00:00
Refactor the transformers loader (#6859)
This commit is contained in:
parent
6ba0164c70
commit
ae02ffc605
18 changed files with 464 additions and 528 deletions
|
|
@ -2,13 +2,12 @@ import datetime
|
|||
from pathlib import Path
|
||||
|
||||
import pandas as pd
|
||||
import torch
|
||||
from datasets import load_dataset
|
||||
from tqdm import tqdm
|
||||
|
||||
from modules import shared
|
||||
from modules.logging_colors import logger
|
||||
from modules.models import clear_torch_cache, load_model, unload_model
|
||||
from modules.models import load_model, unload_model
|
||||
from modules.models_settings import get_model_metadata, update_model_parameters
|
||||
from modules.text_generation import encode
|
||||
|
||||
|
|
@ -39,6 +38,10 @@ def calculate_perplexity(models, input_dataset, stride, _max_length):
|
|||
https://huggingface.co/docs/transformers/perplexity#calculating-ppl-with-fixedlength-models
|
||||
'''
|
||||
|
||||
import torch
|
||||
|
||||
from modules.torch_utils import clear_torch_cache
|
||||
|
||||
if shared.args.loader == "llama.cpp":
|
||||
logger.error("Perplexity evaluation is not implemented for the llama.cpp loader.")
|
||||
raise ValueError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue