Skip to content

Commit

Permalink
Remove pyext from dependencies (#2921)
Browse files Browse the repository at this point in the history
  • Loading branch information
yifanmai authored Aug 13, 2024
1 parent b2f87f8 commit 2d00555
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ install_requires=

# Basic metrics
nltk~=3.7
pyext~=0.7
rouge-score~=0.1.2
scipy~=1.10
uncertainty-calibration~=0.1.4
Expand Down
12 changes: 11 additions & 1 deletion src/helm/benchmark/metrics/code_metrics_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,24 @@
import sys
import tempfile
from typing import List, Union, Dict, Optional
from types import ModuleType
from unittest.mock import patch, mock_open

import numpy as np
from pyext import RuntimeModule

from helm.common.hierarchical_logger import hlog


class RuntimeModule(ModuleType):
"""crfm-helm's replacement for pyext.RuntimeModule, since pyext is not supported by Python >=3.11"""

@staticmethod
def from_string(module_name: str, module_doc: str, module_contents: str) -> "RuntimeModule":
module = RuntimeModule(module_name, module_doc)
exec(module_contents, module.__dict__)
return module


# === APPS evaluation below ===
class CodeType(Enum):
call_based = 0
Expand Down

0 comments on commit 2d00555

Please sign in to comment.