-
Notifications
You must be signed in to change notification settings - Fork 3
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
pydata/sparse
wrappers for levels, COO
, and CSC/CSR
formats
#1
pydata/sparse
wrappers for levels, COO
, and CSC/CSR
formats
#1
Conversation
This looks awesome! I won't have time for a detailed review until tomorrow, but on first glance this looks great! |
To answer your questions:
|
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.
LGTM overall except the dependency on sparse. I'd invert the depencency, and move those bits to sparse
instead (otherwise we have a circular depencency, and that isn't nice).
2ae072d
to
ca887be
Compare
@hameerabbasi FYI, I added an initial setup for CI, but it didn't run, I guess GitHub workflows need to be enabled in repo's settings? |
TBH, I'm not entirely sure how
That SGTM, but I guess we should ask @willow-ahrens @willow-ahrens For context, we follow pre-commit rules for linting and formatting. It's quite nice with auto fixes, even in PRs. |
I think that's fine for now! Eventually we may want to use an independent source of truth, but this is fine for now. I don't think circular dependencies will be an issue because it's not finch that depends on sparse, the test environment depends on sparse. The only issue is that if sparse ever begins to use Finch, then testing finch against sparse is just testing finch against itself.
Sometimes CI needs to be committed to main before it runs. Maybe make a separate PR for CI and we can merge it, then use this branch to test it?
For CI, absolutely let's get that going. For build process, I'm open to this but I'd like to discuss in a meeting. Poetry is a popular option and it's really quite nice. I encourage you to give it a try! What in particular do you want to fix about the build process? What led to pydata/sparse using setuptools-scm? If we do find it necessary, could we change the build system in a separate PR?
Yes absolutely, let's get that going in a separate PR and merge it so that we can test it out on this one! |
Here's the guide I was following to use Poetry: https://www.freecodecamp.org/news/how-to-build-and-publish-python-packages-with-poetry/ |
pydata/sparse
wrappers for levels, COO
, and CSC
formatspydata/sparse
wrappers for levels, COO
, and CSC/CSR
formats
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.
Modulo my suggested change to printing, I approve of the new functionality. Please make changes to CI as a separate PR. Please also make changes to the build system as another separate PR. Thanks for helping out with this!
src/finch/tensor.py
Outdated
class _Display: | ||
def __repr__(self): | ||
return self._obj.__repr__() | ||
|
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.
This should be:
class _Display:
def __repr__(self):
return jl.sprint(jl.show, self._obj)
def __str__(self):
return jl.sprint(jl.show, jl.MIME("text/plain"), self._obj)
Once you add CI and pre-commit hooks in a separate PR, I'll make sure they run and that CI must pass before merging. |
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.
I didn't catch this the first time around, but CSR is not Sparse(Dense(...)). Rather, it is the transposition of CSC. Sparse(Dense(...)) is a weird format that looks like
[ 0 0 0 0;
1 2 3 4;
0 0 0 0;
0 0 0 0;
6 7 8 9]
107e3bb
to
bde02fe
Compare
bde02fe
to
5a53b62
Compare
From the CI:
Looks like we need pytest-cov in the test deps. |
dcc9910
to
89accb7
Compare
@hameerabbasi Now tests are running in the CI. One thing - I changed |
.github/workflows/ci.yml
Outdated
@@ -35,15 +35,15 @@ jobs: | |||
allow-softlinks: true | |||
environment-file: ci/environment.yml | |||
python-version: ${{ matrix.python }} | |||
miniforge-variant: Miniforge | |||
miniforge-variant: Mambaforge |
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.
miniforge-variant: Mambaforge | |
miniforge-version: latest |
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.
Also we should move to setup-miniconda@v3
89accb7
to
fa4eef1
Compare
fa4eef1
to
8ac85c9
Compare
Hi @willow-ahrens @hameerabbasi, I pushed the latest changes: There are simple COO, CSF, CSR, and CSC wrappers together with Finch Tensor/Levels wrappers. In terms of row/column major manipulation, instead of reversing dims I did it by reinterpreting the input as column major on entry |
Ah, I see. Let's merge it and make a separate PR to support swizzles. |
Hi @willow-ahrens @hameerabbasi,
Here's a PR with a draft implementation of Python wrappers for Tensor constructors, levels, COO, and CSC formats. Some comments:
test_coo
andtest_csc
show the construction of fibers using the same code as Hameer's notebook (which adheres topydata/sparse
). Tomorrow I will addCSR
andDOK/SparseHash
so the whole notebook can be executed (except forGCXS
)._obj
attribute which is the underlying Julia object.Tensor
can be constructed by providinglevels
description (wrapper classes!) and NumPy/Finch array, or just Finch object directly (jl_data
).todense
function that is heavily used inpydata/sparse
. Here it's done by constructing a newlvl
description withDense
levels only and creating a new Tensor.Questions:
fill_value
inElement
? I mean the first type parameter inElement{0.0, Float64, Int64}(...)
Tensor
? Right now I obtain shape by iterating throughlevel
s and aggregatingshape
into one tuple.