Coder Social home page Coder Social logo

Specify GPU Card(s) to run on about prettytensor HOT 3 OPEN

google avatar google commented on June 25, 2024
Specify GPU Card(s) to run on

from prettytensor.

Comments (3)

eiderman avatar eiderman commented on June 25, 2024

Pretty Tensor is completely compatible with the device scoping mechanism in TF.

If you wrap your model with:

with tf.device('/gpu:1'):
  build_my_model()

then it will assign the appropriate device. When you explicitly specify a gpu device, no attempt is made to put cpu-only ops on a cpu, so for those ops (such as lookup_embedding) you would either need to be in a nested device context or built before the gpu device specification.

Intelligently guessing the correct device is outside the scope of PT, but support for explicit assignments is definitely in scope.

from prettytensor.

mschonwe avatar mschonwe commented on June 25, 2024

Could you provide an example, in the shakespeare.py, where would the with tf.device('/gpu:1') go?

Presumably the change you made (Issue #1) for embedding lookup would provide the necessary assignment for that Op?
with tf.device('/cpu:0'):
embedded = text_in.embedding_lookup(CHARS, [EMBEDDING_SIZE])

from prettytensor.

eiderman avatar eiderman commented on June 25, 2024

It requires 2 changes and you've alerted me to a few more bugs with device placement.

Before entering the gpu scope, please create the global variable (either on the default device or explicitly on cpu). I added it on line 150:

global_step = pt.global_step()

I surrounded 63-73 in the gpu device context.

Since I don't think that this should be as hard as it is, I've opened a new issue to track this.

from prettytensor.

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.