torchaudio 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/torchaudio/datasets/utils.rb +12 -31
- data/lib/torchaudio/datasets/yesno.rb +2 -2
- data/lib/torchaudio/version.rb +1 -1
- data/lib/torchaudio.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51d6bb5a47b3727241c0447b57e5f451c03ce58f6bc0d68d8dc27e1a7d401d9a
|
|
4
|
+
data.tar.gz: aada94ed4edd1ab1ae80157e17193b271ef431a118ed170179cf9bbe3a1cf81a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b709606a79034c139804a690d1e37ce4b9e6d1244e7054040a48c6a6b5b955558784243fcb09071bd8567f42bc73470a5fe9d7d58c7ad20cacd2543ac9cba695
|
|
7
|
+
data.tar.gz: d92d25e7a6868d78af56ed208c362826d4237738b477776d0e393628cb5c6882aa384c51e21e26f5ac88ab0ebf1c59536da7768a64b52adddeb3601af9d95f2c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -16,7 +16,7 @@ gem "torchaudio"
|
|
|
16
16
|
|
|
17
17
|
This library follows the [Python API](https://pytorch.org/audio/). Many methods and options are missing at the moment. PRs welcome!
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## Files
|
|
20
20
|
|
|
21
21
|
Load a file (requires [torchcodec](https://github.com/ankane/torchcodec-ruby))
|
|
22
22
|
|
|
@@ -15,45 +15,26 @@ module TorchAudio
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
# follows redirects
|
|
18
|
-
def download_url_to_file(url, dst, hash_value, hash_type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
|
26
|
-
request = Net::HTTP::Get.new(uri)
|
|
27
|
-
|
|
28
|
-
http.request(request) do |response|
|
|
29
|
-
case response
|
|
30
|
-
when Net::HTTPRedirection
|
|
31
|
-
location = response["location"]
|
|
32
|
-
when Net::HTTPSuccess
|
|
33
|
-
tmp = "#{Dir.tmpdir}/#{Time.now.to_f}" # TODO better name
|
|
34
|
-
File.open(tmp, "wb") do |f|
|
|
35
|
-
response.read_body do |chunk|
|
|
36
|
-
f.write(chunk)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
18
|
+
def download_url_to_file(url, dst, hash_value, hash_type)
|
|
19
|
+
URI.parse(url).open(max_redirects: 10) do |download|
|
|
20
|
+
# TODO use hash_type
|
|
21
|
+
digest =
|
|
22
|
+
if download.respond_to?(:path)
|
|
23
|
+
download.flush
|
|
24
|
+
Digest::MD5.file(download.path).hexdigest
|
|
39
25
|
else
|
|
40
|
-
|
|
26
|
+
Digest::MD5.hexdigest(download.string)
|
|
41
27
|
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
28
|
|
|
45
|
-
if location
|
|
46
|
-
download_url_to_file(location, dst, hash_value, hash_type, redirects + 1)
|
|
47
|
-
else
|
|
48
29
|
# check hash
|
|
49
|
-
|
|
50
|
-
if Digest::MD5.file(tmp).hexdigest != hash_value
|
|
30
|
+
if digest != hash_value
|
|
51
31
|
raise "The hash of #{dst} does not match. Delete the file manually and retry."
|
|
52
32
|
end
|
|
53
33
|
|
|
54
|
-
|
|
55
|
-
dst
|
|
34
|
+
IO.copy_stream(download, dst)
|
|
56
35
|
end
|
|
36
|
+
|
|
37
|
+
dst
|
|
57
38
|
end
|
|
58
39
|
|
|
59
40
|
# extract_tar_gz doesn't list files, so just return to_path
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module TorchAudio
|
|
2
2
|
module Datasets
|
|
3
3
|
class YESNO < Torch::Utils::Data::Dataset
|
|
4
|
-
URL = "
|
|
4
|
+
URL = "https://www.openslr.org/resources/1/waves_yesno.tar.gz"
|
|
5
5
|
FOLDER_IN_ARCHIVE = "waves_yesno"
|
|
6
6
|
CHECKSUMS = {
|
|
7
|
-
"
|
|
7
|
+
"https://www.openslr.org/resources/1/waves_yesno.tar.gz" => "962ff6e904d2df1126132ecec6978786"
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
def initialize(root, url: URL, folder_in_archive: FOLDER_IN_ARCHIVE, download: false)
|
data/lib/torchaudio/version.rb
CHANGED
data/lib/torchaudio.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: torchaudio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -57,14 +57,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '3.
|
|
60
|
+
version: '3.3'
|
|
61
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
|
63
63
|
- - ">="
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
65
|
version: '0'
|
|
66
66
|
requirements: []
|
|
67
|
-
rubygems_version: 4.0.
|
|
67
|
+
rubygems_version: 4.0.14
|
|
68
68
|
specification_version: 4
|
|
69
69
|
summary: Data manipulation and transformation for audio signal processing
|
|
70
70
|
test_files: []
|