Coder Social home page Coder Social logo

tffs's Introduction

TFFS

TensorFlow Filesystem - Access Tensors Differently

A funny way to access your tensorflow model's tensors.

Use this project to map your model into a filesystem. Then, access your tensors as if they were files, using your favorite UNIX commands.

tffs is implemented using Filesystem in Userspace (FUSE). It requires tensorflow and fusepy to be installed.

To learn more, read the accompanying blog post.

Usage

  1. Create a model - out of the scope of this project :)

  2. Mount your model so it'll be accessible through the filesystem:

    python tffs.py --model PATH_TO_MODEL --mount MOUNT_POINT

    PATH_TO_MODEL is either a directory containing a .meta file, or the .meta file itself.

    If there's also a file containing the weights with the same name as the .meta file (without the .meta extension), it'll be loaded as well.

  3. Reap the fruits. Assuming MOUNT_POINT is ~/tf:

Command Description
find ~/tf list all scopes and tensors
find ~/tf -type f list all tensors
xattr -l ~/tf/.../tensor get attributes of a tensor
cat ~/tf/.../tensor print the value found in a tensor
~/tf/bin/inputs -d 3 ~/tf/.../tensor print the inputs to a tensor, recursively
~/tf/bin/outputs --no-fs .../tensor print the outputs to a tensor, without using the mount prefix

tffs's People

Stargazers

Jon Repp avatar Ramsey avatar Min Sun avatar Alexandru Burlacu avatar Andres F. Perez avatar Mehdi Shibahara avatar Yibo Li avatar  avatar

Watchers

James Cloos avatar

tffs's Issues

No such file or directory

Hi @yoel-zeldes , what a great idea. I wanted to give it a try so I cloned your repo, installed fusepy but I'm getting the following error when I try python ../tffs/tffs.py --model chkpts/f64c32_conv/chkpt-682.meta --mount mount/

Traceback (most recent call last):
  File "../tffs/tffs.py", line 290, in <module>
    FUSE(TfFs(mount_point=args.mount, model_path=args.model), args.mount, foreground=True)
  File "../tffs/tffs.py", line 162, in __init__
    self._populate_bin(mount_point)
  File "../tffs/tffs.py", line 186, in _populate_bin
    TENSOR_TO_TENSORS_PLACEHOLDER=str(tensor_to_tensors()))
  File "../tffs/tffs.py", line 145, in _read_template_script
    with open(template_path, 'r') as f:
IOError: [Errno 2] No such file or directory: 'print_tensor_dependencies.py'
ls -1 chkpts/f64c32_conv/chkpt-682.*
chkpts/f64c32_conv/chkpt-682.data-00000-of-00001
chkpts/f64c32_conv/chkpt-682.index
chkpts/f64c32_conv/chkpt-682.meta

What am I doing wrong here?

My conda environment has:

Package                            Version
---------------------------------- -----------
absl-py                            0.5.0
astor                              0.7.1
backports-abc                      0.5
backports.functools-lru-cache      1.5
backports.shutil-get-terminal-size 1.0.0
backports.weakref                  1.0.post1
bashplotlib                        0.6.5
certifi                            2018.10.15
chardet                            3.0.4
configparser                       3.5.0
cycler                             0.10.0
decorator                          4.3.0
enum34                             1.1.6
funcsigs                           1.0.2
functools32                        3.2.3.post2
fusepy                             3.0.1
futures                            3.2.0
gast                               0.2.0
grpcio                             1.12.1
h5py                               2.8.0
idna                               2.7
influxdb                           5.2.0
ipython                            5.8.0
ipython-genutils                   0.2.0
kiwisolver                         1.0.1
linecache2                         1.0.0
Markdown                           3.0.1
matplotlib                         2.2.3
mkl-fft                            1.0.6
mkl-random                         1.0.1
mock                               2.0.0
numpy                              1.15.3
olefile                            0.46
pathlib2                           2.3.2
pbr                                4.3.0
pexpect                            4.6.0
pickleshare                        0.7.5
Pillow                             5.3.0
pip                                18.1
progressbar                        2.5
prompt-toolkit                     1.0.15
protobuf                           3.6.0
ptyprocess                         0.6.0
pudb                               2018.1
Pygments                           2.2.0
pyparsing                          2.2.2
python-dateutil                    2.7.5
pytz                               2018.7
requests                           2.20.0
scandir                            1.9.0
setuptools                         40.4.3
simplegeneric                      0.8.1
singledispatch                     3.4.0.3
six                                1.11.0
subprocess32                       3.5.3
tabulate                           0.8.2
tensorboard                        1.10.0
tensorflow                         1.10.0
termcolor                          1.1.0
tornado                            5.1.1
tqdm                               4.28.1
traceback2                         1.4.0
traitlets                          4.3.2
unittest2                          1.1.0
urllib3                            1.24
urwid                              2.0.1
wcwidth                            0.1.7
Werkzeug                           0.14.1
wheel                              0.32.2

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.