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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 689c84e4854288639090d826e4f3844a7e3cabf6ec68cf623b609678a8934ff6
4
- data.tar.gz: 07afae5c2e18256d62b31362acf7b1347cff2a332fe0de3659af463abbaa2dd4
3
+ metadata.gz: 51d6bb5a47b3727241c0447b57e5f451c03ce58f6bc0d68d8dc27e1a7d401d9a
4
+ data.tar.gz: aada94ed4edd1ab1ae80157e17193b271ef431a118ed170179cf9bbe3a1cf81a
5
5
  SHA512:
6
- metadata.gz: c62e2dcbc6daa4d1e574954101b889f391018fb078a89f200e35a70efff80e7b85eabb1fd7322212c5199644f0a4e8a16057e6863e6501321b46ebba5ea95070
7
- data.tar.gz: a764b0585aaee7b6f7c50cc65f3348c8a48cba317ffe15b6c455422db4d30c1fc26784e58574ce238d749e849a7a283054158850ef35e142154141a63ddb987e
6
+ metadata.gz: b709606a79034c139804a690d1e37ce4b9e6d1244e7054040a48c6a6b5b955558784243fcb09071bd8567f42bc73470a5fe9d7d58c7ad20cacd2543ac9cba695
7
+ data.tar.gz: d92d25e7a6868d78af56ed208c362826d4237738b477776d0e393628cb5c6882aa384c51e21e26f5ac88ab0ebf1c59536da7768a64b52adddeb3601af9d95f2c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.6.0 (2026-06-29)
2
+
3
+ - Dropped support for Ruby < 3.3
4
+
1
5
  ## 0.5.0 (2026-02-27)
2
6
 
3
7
  - Added support for CUDA 12.9+
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
- ## Basics
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, redirects = 0)
19
- raise "Too many redirects" if redirects > 10
20
-
21
- uri = URI(url)
22
- tmp = nil
23
- location = nil
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
- raise Error, "Bad response"
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
- # TODO use hash_type
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
- FileUtils.mv(tmp, dst)
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 = "http://www.openslr.org/resources/1/waves_yesno.tar.gz"
4
+ URL = "https://www.openslr.org/resources/1/waves_yesno.tar.gz"
5
5
  FOLDER_IN_ARCHIVE = "waves_yesno"
6
6
  CHECKSUMS = {
7
- "http://www.openslr.org/resources/1/waves_yesno.tar.gz" => "962ff6e904d2df1126132ecec6978786"
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)
@@ -1,3 +1,3 @@
1
1
  module TorchAudio
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/torchaudio.rb CHANGED
@@ -3,7 +3,7 @@ require "torch"
3
3
 
4
4
  # stdlib
5
5
  require "digest"
6
- require "fileutils"
6
+ require "open-uri"
7
7
  require "rubygems/package"
8
8
  require "set"
9
9
 
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.5.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.2'
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.3
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: []