File tree Expand file tree Collapse file tree 10 files changed +19
-14
lines changed
Expand file tree Collapse file tree 10 files changed +19
-14
lines changed Original file line number Diff line number Diff line change 1818 fail-fast : false
1919 matrix :
2020 version :
21- - ' 1.7 '
22- - ' 1'
21+ - ' 1.9 '
22+ # - '1' # add back when 1.10 is out
2323 - ' nightly'
2424 os :
2525 - ubuntu-latest
Original file line number Diff line number Diff line change 3030 token : ${{ secrets.GITHUB_TOKEN }}
3131 # Edit the following line to reflect the actual name of the GitHub Secret containing your private key
3232 ssh : ${{ secrets.DOCUMENTER_KEY }}
33- # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
33+ # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}
Original file line number Diff line number Diff line change 11channels = [" conda-forge" ]
22
33[deps ]
4- h5py = " "
5- pillow = " >=9.1, <10"
4+ # h5py = ""
5+ # pillow = ">=9.1, <10"
6+ # pyarrow = "==6.0.0"
7+ datasets = " >=2.12, <3"
68numpy = " >=1.20, <2"
7- datasets = " >=2.7, <3 "
8- pyarrow = " ==6.0.0 "
9+ pillow = " "
10+
Original file line number Diff line number Diff line change 11name = " HuggingFaceDatasets"
22uuid = " d94b9a45-fdf5-4270-b024-5cbb9ef7117d"
33authors = [" Carlo Lucibello" ]
4- version = " 0.3.0 "
4+ version = " 0.3.1 "
55
66[deps ]
77CondaPkg = " 992eb4ea-22a4-4c89-a5bb-47a3300528ab"
@@ -16,7 +16,7 @@ DLPack = "0.1"
1616ImageCore = " 0.9"
1717MLUtils = " 0.4.1"
1818PythonCall = " 0.9"
19- julia = " 1.7 "
19+ julia = " 1.9 "
2020
2121[extras ]
2222Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ function __init__()
4141 # https://cjdoris.github.io/PythonCall.jl/dev/pythoncall-reference/#PythonCall.pycopy!
4242 PythonCall. pycopy! (datasets, pyimport (" datasets" ))
4343 PythonCall. pycopy! (PIL, pyimport (" PIL" ))
44+ pyimport (" PIL.PngImagePlugin" )
45+ pyimport (" PIL.JpegImagePlugin" )
4446 PythonCall. pycopy! (np, pyimport (" numpy" ))
4547 PythonCall. pycopy! (copy, pyimport (" copy" ))
4648end
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ version of [`with_format`](@ref).
107107"""
108108function set_format! (ds:: Dataset , format)
109109 if format == " julia"
110- # ds.pyds.set_format("numpy ")
110+ ds. pyds. reset_format () # or d.pyd. set_format("python ")
111111 ds. jltransform = py2jl
112112 else
113113 ds. pyds. set_format (format)
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ version of [`with_format`](@ref).
102102"""
103103function set_format! (d:: DatasetDict , format)
104104 if format == " julia"
105- d. pyd. set_format ( " numpy " )
105+ d. pyd. reset_format ( )
106106 d. jltransform = py2jl
107107 else
108108 d. pyd. set_format (format)
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ function _pyconvert(x::Py)
2121 end
2222end
2323
24+ # Do nothing on a non-Py object.
2425_pyconvert (x) = x
2526
2627"""
@@ -30,6 +31,7 @@ Convert Python types to Julia types applying `pyconvert` recursively.
3031"""
3132py2jl
3233
34+ # py2jl recurses through pycanonicalize and converts through _pyconvert
3335py2jl (x) = pycanonicalize (_pyconvert (x))
3436
3537pycanonicalize (x) = x
Original file line number Diff line number Diff line change 7474 @test x isa Dict
7575 @test x[" label" ] == - 1
7676 @test x[" idx" ] == 0
77- @show x[" premise" ] |> typeof
7877 @test x[" premise" ] isa AbstractString
7978 @test x[" premise" ] == " The cat sat on the mat."
8079 @test x[" hypothesis" ] isa AbstractString
Original file line number Diff line number Diff line change 1919@testset " with_format(julia)" begin
2020 d = with_format (mnist, " julia" )
2121 ds = d[" test" ]
22- @test ds. format[" type" ] == " numpy "
22+ @test ds. format[" type" ] == nothing
2323 x = ds[1 ]
2424 @test x isa Dict
2525 @test x[" label" ] isa Int
2626 @test x[" label" ] == 7
27- @test x[" image" ] isa Matrix{UInt8 }
27+ @test x[" image" ] isa AbstractMatrix{ <: Gray }
2828 @test size (x[" image" ]) == (28 , 28 )
2929end
3030
You can’t perform that action at this time.
0 commit comments