Skip to content

Commit

Permalink
update torch versions
Browse files Browse the repository at this point in the history
  • Loading branch information
turgut090 committed Apr 11, 2024
1 parent 50e8d00 commit a527a77
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

## 2.2.2

- Updated installation function ```install_fastai```

## 2.2.1

- Fixed breaking changes during model training
Expand Down
18 changes: 9 additions & 9 deletions R/install_fastai.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param TPU official way to install Pytorch-XLA 1.13
#' @return None
#' @export
install_fastai <- function(version, gpu = FALSE, cuda_version = '11.6', overwrite = FALSE,
install_fastai <- function(version, gpu = FALSE, cuda_version = '11.8', overwrite = FALSE,
extra_pkgs = c('timm','fastinference[interp]'),
TPU = FALSE) {
# extensions
Expand Down Expand Up @@ -62,15 +62,15 @@ install_fastai <- function(version, gpu = FALSE, cuda_version = '11.6', overwrit
}

# linux
cuda_linux = c('torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116',
cuda_linux = c('torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118',
'torch torchvision torchaudio')
linux_cpu = c('torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu')

xla = "cloud-tpu-client==0.10 torch==1.13.0 https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-1.13-cp38-cp38-linux_x86_64.whl tensorboard-plugin-profile"
xla = "torch~=2.2.0 torch_xla[tpu]~=2.2.0 -f https://storage.googleapis.com/libtpu-releases/index.html"

# windows
cuda_windows = c('torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116',
'torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117')
cuda_windows = c('torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118',
'torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121')
cpu_windows = c('torch torchvision torchaudio')

if('torch' %in% required_py_pkgs ) {
Expand Down Expand Up @@ -107,10 +107,10 @@ install_fastai <- function(version, gpu = FALSE, cuda_version = '11.6', overwrit
if(py_av) {

if (os() %in% 'linux' & !length(required_py_pkgs) == 0 & !TPU) {
if (os() %in% 'linux' & gpu & cuda_version %in% '11.6' & torch_r & !length(required_py_pkgs) == 0) {
if (os() %in% 'linux' & gpu & cuda_version %in% '11.8' & torch_r & !length(required_py_pkgs) == 0) {
fastai_py_install( c(required_py_pkgs, cuda_linux[1]) )

} else if (os() %in% 'linux' & gpu & cuda_version %in% '11.7' & torch_r & !length(required_py_pkgs) == 0) {
} else if (os() %in% 'linux' & gpu & cuda_version %in% '12.1' & torch_r & !length(required_py_pkgs) == 0) {
fastai_py_install(c(required_py_pkgs, cuda_linux[2]) )

} else if(!gpu & torch_r & !length(required_py_pkgs) == 0) {
Expand All @@ -134,10 +134,10 @@ install_fastai <- function(version, gpu = FALSE, cuda_version = '11.6', overwrit
}

if (os() %in% 'windows' & !length(required_py_pkgs) == 0 & torch_r & !length(required_py_pkgs) == 0) {
if (os() %in% 'windows' & gpu & cuda_version %in% '11.6' & torch_r & !length(required_py_pkgs) == 0) {
if (os() %in% 'windows' & gpu & cuda_version %in% '11.8' & torch_r & !length(required_py_pkgs) == 0) {
fastai_py_install( c(required_py_pkgs, cuda_windows[1]) )

} else if (os() %in% 'windows' & gpu & cuda_version %in% '11.7' & torch_r & !length(required_py_pkgs) == 0) {
} else if (os() %in% 'windows' & gpu & cuda_version %in% '12.1' & torch_r & !length(required_py_pkgs) == 0) {
fastai_py_install( c(required_py_pkgs, cuda_windows[2]) )

} else if(!gpu & torch_r & !length(required_py_pkgs) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion man/install_fastai.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a527a77

Please sign in to comment.