Coder Social home page Coder Social logo

Comments (7)

trinetra75 avatar trinetra75 commented on September 23, 2024 1

Thank you!

I'll try asap and report if it worked...

from torch.

dfalbel avatar dfalbel commented on September 23, 2024

This doesn't look like the error that torch would show when failing to start, but an error caused by trying to use torch functions with lantern not installed.

Are you sure that all torch calls are avoided when useTorch = FALSE?

from torch.

trinetra75 avatar trinetra75 commented on September 23, 2024

I'm pretty sure that no torch command is executed once the flag is set to FALSE.
And I'm also relatively sure the above is the offending command (it is in a vignette running on a Bioconductor machine...)

Again I'm pretty open to suggestions on how to query whether the torch package is ready to be used or not :)

from torch.

dfalbel avatar dfalbel commented on September 23, 2024

torch::torch_is_installed() is the function that checks if torch binaries are correctly installed. You can use it to check for toprch in your vignette.

I see the problem now. Actually we are not allowed to raise an error in library() for CRAN rules, so we just allow library() to just ignore the error on non interactive environments.

from torch.

trinetra75 avatar trinetra75 commented on September 23, 2024

Thank you for your prompt answers!

Does your suggestion implies I can use torch::torch_is_installed() before/instead of library("torch")?
Naturally assuming I already checked the presence of the torch library with requireNamespace("torch", quietly = TRUE)...

from torch.

dfalbel avatar dfalbel commented on September 23, 2024

Yes, I think you can do something like:

useTorch <- requireNamespace("torch", quietly = TRUE) && torch::torch_is_installed()

from torch.

trinetra75 avatar trinetra75 commented on September 23, 2024

Hi, the code you suggested, worked perfectly:

useTorch <- requireNamespace("torch", quietly = TRUE) && torch::torch_is_installed()

Thank you very much!

Might I suggest to include this code in the documentation/examples?
I suppose I'm not the only one that might need this... Thanks again!

from torch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.