Giter Club home page Giter Club logo

Comments (2)

waleedka avatar waleedka commented on July 21, 2024

We don't expect both frameworks to be installed. Should probably do conditional imports to import only what's available.

I put the import in init to simplify importing and calling the functions. The user shouldn't need to specifically import PyTorch or TF specific modules. I would keep the imports in init but update the other modules to not throw an error if a framework they don't need is not available.

from hiddenlayer.

philferriere avatar philferriere commented on July 21, 2024

I'm personally a big fan of the following notation:

from ww import builder_tf

It doesn't require that you explicitly import anything in __init__.py. You can test this with the new setup.py file I've included. Just run the following command to install the package in your environment:

$ pip install .
Processing e:\repos\ww-dev
Building wheels for collected packages: weightwatcher
  Running setup.py bdist_wheel for weightwatcher ... done
  Stored in directory: C:\Users\Phil\AppData\Local\pip\Cache\wheels\17\e2\0c\1237efb07e9b9cdd2a3e1621a699435738275e3fcb15108535
Successfully built weightwatcher
distributed 1.21.8 requires msgpack, which is not installed.
Installing collected packages: weightwatcher
Successfully installed weightwatcher-0.1

It also doesn't introduce the problem of having to deal with conditional imports. It also doesn't make the code blow-up just by importing the package. Of course, no matter what, if the relevant DL framework is not installed, you will get into trouble when importing the ww TF or PyTorch builder.

from hiddenlayer.

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.