Skip to content

Commit

Permalink
Merge pull request #592 from mdekstrand/fix/torch-numpy-version
Browse files Browse the repository at this point in the history
Fix NumPy/PyTorch version problem and item KNN type problem w/ NumPy array
  • Loading branch information
mdekstrand authored Jan 7, 2025
2 parents 51ef299 + 8472e4b commit 9909d6b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 614 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ jobs:
shell: bash
env:
PYTHON: '${{steps.install-python.outputs.python-path}}'
UV_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
UV_INDEX_STRATEGY: unsafe-first-match
- name: "🔍 Inspect environment"
run: |
python -m lenskit.util.envcheck
Expand Down Expand Up @@ -204,8 +202,6 @@ jobs:
shell: bash
env:
PYTHON: '${{steps.install-python.outputs.python-path}}'
UV_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
UV_INDEX_STRATEGY: unsafe-first-match
- name: "🔍 Inspect environment"
run: |
python -m lenskit.util.envcheck
Expand Down Expand Up @@ -297,8 +293,6 @@ jobs:
shell: bash
env:
PYTHON: '${{steps.install-python.outputs.python-path}}'
UV_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
UV_INDEX_STRATEGY: unsafe-first-match
- name: "🔍 Inspect environment"
run: |
python -m lenskit.util.envcheck
Expand Down Expand Up @@ -389,8 +383,6 @@ jobs:
shell: bash
env:
PYTHON: '${{steps.install-python.outputs.python-path}}'
UV_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
UV_INDEX_STRATEGY: unsafe-first-match
- name: "🔍 Inspect environment"
run: |
python -m lenskit.util.envcheck
Expand Down Expand Up @@ -481,8 +473,6 @@ jobs:
shell: bash
env:
PYTHON: '${{steps.install-python.outputs.python-path}}'
UV_EXTRA_INDEX_URL: 'https://download.pytorch.org/whl/cpu'
UV_INDEX_STRATEGY: unsafe-first-match
- name: "🔍 Inspect environment"
run: |
python -m lenskit.util.envcheck
Expand Down
2 changes: 1 addition & 1 deletion lenskit/lenskit/knn/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def __call__(self, query: QueryInput, items: ItemList) -> ItemList:

# subset the model to rated and target items
model = self.sim_matrix_
model = model[ri_valid_nums, :]
model = model[ri_valid_nums.numpy(), :]
assert isinstance(model, csr_array)
model = model[:, ti_valid_nums]
assert isinstance(model, csr_array)
Expand Down
9 changes: 9 additions & 0 deletions lenskit/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ raw-options = { root = "..", version_scheme = "guess-next-dev" }

[tool.hatch.build.hooks.vcs]
version-file = "lenskit/_version.py"

# override where UV gets pytorch
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[tool.uv.sources]
torch = [{ index = "pytorch-cpu" }]
Loading

0 comments on commit 9909d6b

Please sign in to comment.