Skip to content

Commit

Permalink
Another fix to call llama functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan committed Jun 3, 2024
1 parent 45af393 commit be36918
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions llm_eval/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ def prepare_output(self):
df = pd.concat([df, pd.DataFrame(rows)], ignore_index=True)
return df


def process_dataset(self):
df = self.prepare_output()
for model_name, model_handler in self.models.items(): # Unpack the tuple correctly
for model_name, model_handler in self.models.items():
self.current_model = model_name
print(f"Loading {model_name}...")
self.tokenizer, self.model = model_handler.load_model_and_tokenizer(model_name)
for index, row in df[df['model'] == model_name].iterrows(): # Process the correct group rather than the entire df
self.tokenizer, self.model = model_handler().load_model_and_tokenizer(model_name)
for index, row in df[df['model'] == model_name].iterrows():
print(f"Generating outputs for {row['id']}")
for col in df.columns:
if col.endswith('.input'):
Expand All @@ -103,7 +102,6 @@ def process_dataset(self):
self.unload_model(model_name)
return df


def unload_model(self, model_id):
del self.model, self.tokenizer
import torch
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "llm-eval"
version = "0.6.1"
version = "0.6.2"
authors = [
{name = "Jonathan Eisenzopf", email = "[email protected]"},
]
Expand Down

0 comments on commit be36918

Please sign in to comment.