the models work, lying sometimes works, and lie-dection leaks

This commit is contained in:
wassname
2023-06-10 20:35:11 +08:00
parent 38a5e8a15a
commit 62c1a0a582
5 changed files with 3664 additions and 365 deletions
+7
View File
@@ -183,3 +183,10 @@ How to get the prompt? more direct. Just a lying one. Just a true one.
Maybe just try:
"The following movie review expresses what sentiment?" just like in ELK and lillian wangs...
BUG FIXME... I was returning the answers for the last shot... so totally random, jeeze
# 2023-06-10 18:01:30
It seems to be working now... but there is data leakage, where the midn read know more than the model.... so it's not using the models knowledge... it's cheating
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+19 -5
View File
@@ -3,6 +3,7 @@ import os
os.environ['CUDA_VISIBLE_DEVICES']="-1"
import torch
import argparse
import pandas as pd
from transformers import AutoTokenizer, AutoModelForCausalLM
from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE
from pathlib import Path
@@ -29,16 +30,29 @@ def main(model_repo, lora_repo = None, **download_options):
**download_options
)
def sizeof_fmt(num, suffix="B"):
for unit in ["", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"]:
if abs(num) < 1024.0:
return f"{num:3.1f}{unit}{suffix}"
num /= 1024.0
return f"{num:.1f}Yi{suffix}"
def dir_size(p: Path) -> int:
return sum(f.stat().st_size for f in p.glob('**/*') if f.is_file())
if __name__=="__main__":
files = [f.relative_to(HUGGINGFACE_HUB_CACHE) for f in Path(HUGGINGFACE_HUB_CACHE).glob('models--*')]
files = "\n".join(sorted([str(f).replace('--', '/') for f in files]))
print(HUGGINGFACE_HUB_CACHE)
print("Downloaded models:\n", files)
1/0
# Report already downloaded models in a dataframe
files = [dict(
name=str(f.relative_to(HUGGINGFACE_HUB_CACHE)).replace('models--', '').replace('--', '/'),
dir_size=sizeof_fmt(dir_size(f)),
ctime=f.stat().st_ctime
) for f in Path(HUGGINGFACE_HUB_CACHE).glob('models--*')]
df_files = pd.DataFrame(files).sort_values('ctime')
df_files['ctime'] = pd.to_datetime(df_files['ctime'], unit='s').round('1T')
print('models found in ', HUGGINGFACE_HUB_CACHE)
print(df_files)
parser = argparse.ArgumentParser()
parser.add_argument('model_repo', type=str)