pytorch.rb 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. module Docs
  2. class Pytorch < UrlScraper
  3. self.name = 'PyTorch'
  4. self.slug = 'pytorch'
  5. self.type = 'sphinx'
  6. self.links = {
  7. home: 'https://pytorch.org/',
  8. code: 'https://github.com/pytorch/pytorch'
  9. }
  10. html_filters.push 'pytorch/entries', 'pytorch/clean_html', 'sphinx/clean_html'
  11. options[:skip] = ['cpp_index.html', 'deploy.html', 'packages.html', 'py-modindex.html', 'genindex.html']
  12. options[:skip_patterns] = [/\Acommunity/, /\A_modules/, /\Anotes/, /\Aorg\/pytorch\//]
  13. options[:max_image_size] = 1_000_000
  14. options[:attribution] = <<-HTML
  15. &copy; 2025, PyTorch Contributors<br>
  16. PyTorch has a BSD-style license, as found in the <a href="https://github.com/pytorch/pytorch/blob/main/LICENSE">LICENSE</a> file.
  17. HTML
  18. version '2.7' do
  19. self.release = '2.7'
  20. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  21. end
  22. version '2.6' do
  23. self.release = '2.6'
  24. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  25. end
  26. version '2.5' do
  27. self.release = '2.5'
  28. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  29. end
  30. version '2.4' do
  31. self.release = '2.4'
  32. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  33. end
  34. version '2.3' do
  35. self.release = '2.3'
  36. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  37. end
  38. version '2.2' do
  39. self.release = '2.2'
  40. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  41. end
  42. version '2.1' do
  43. self.release = '2.1'
  44. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  45. end
  46. version '2.0' do
  47. self.release = '2.0'
  48. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  49. end
  50. version '1.13' do
  51. self.release = '1.13'
  52. self.base_url = "https://docs.pytorch.org/docs/#{release}/"
  53. end
  54. def get_latest_version(opts)
  55. get_latest_github_release('pytorch', 'pytorch', opts)
  56. end
  57. end
  58. end