Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support numpy 2.x now that gguf-py does #61

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@ authors = [{ name = "Theia Vogel", email = "[email protected]" }]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"numpy <2.0.0",
"numpy>=1.26.4",
"scikit-learn>=1.4.0",
"torch>=2.1.2",
"transformers>=4.36.2",
"tqdm>=4.66.1",
"gguf>=0.6.0",
"gguf>=0.13.0",
]

[dependency-groups]
dev = [
"pytest>=8.0.2",
"black>=24.2.0", # make sure to keep this in sync with .github/workflows/ci.yml
"ruff>=0.8.3",
]
dev = ["pytest>=8.0.2", "ruff>=0.8.3"]

[tool.pytest.ini_options]
python_files = ["tests.py"]
Expand Down
6 changes: 3 additions & 3 deletions repeng/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,16 @@ def __neg__(self) -> "ControlVector":
directions[layer] = -self.directions[layer]
return ControlVector(model_type=self.model_type, directions=directions)

def __mul__(self, other: int | float | np.int_ | np.float_) -> "ControlVector":
def __mul__(self, other: int | float | np.number) -> "ControlVector":
directions: dict[int, np.ndarray] = {}
for layer in self.directions:
directions[layer] = other * self.directions[layer]
return ControlVector(model_type=self.model_type, directions=directions)

def __rmul__(self, other: int | float | np.int_ | np.float_) -> "ControlVector":
def __rmul__(self, other: int | float | np.number) -> "ControlVector":
return self.__mul__(other)

def __truediv__(self, other: int | float | np.int_ | np.float_) -> "ControlVector":
def __truediv__(self, other: int | float | np.number) -> "ControlVector":
return self.__mul__(1 / other)


Expand Down
Loading
Loading