-
Notifications
You must be signed in to change notification settings - Fork 705
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
c_idx cast to LongTensor in random sparse projection #113
c_idx cast to LongTensor in random sparse projection #113
Conversation
components[i, c_idx.long()] = data.double()
or
c_idx = [int(t.item()) for t in c_idx]
components[i, c_idx] = data.double() It's taking really much time to get coreset from embedding. Is it expected in patchcore? I'm running on CPU with num_workers: 1 # 36 |
Yes, the coreset computation in the training step is optimized for GPU. Inference should run fine on CPU. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reporting and addressing this issue. I would suggest constructing c_idx
as long
type, like so:
c_idx = torch.tensor(
sample_without_replacement(
n_population=n_features, n_samples=nnz_idx, random_state=self.random_state
),
dtype=torch.int64
)
That way we don't need to cast it afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@alexriedel1 Thanks for your contribution! Let's merge after CI passes. |
@alexriedel1 There seems to be a minor pip install pre-commit
pre-commit install
pre-commit run --all-files |
I guess thats what black wanted to reformat. Unfortunately I wasnt abel to run the pre commit hooks.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for quickly addressing this!
Can you share the error? We will try to update the docs to address this. |
It's an issue on my side. I'm having strange permission issues when trying to run the hooks so dont worry.. |
Fixing #111