On 2023-02-01 at 17:00:11 +0100, Grégory Vanuxem wrote:
> Hello Zakariyya,
> 
> Good! Thanks!
> 
> I'll for sure give it a try. I want to test TensorFlow since some time now.
> But you didn’t tell us, on which operating system/arch dit it supposed to
> work on?

Hello Greg,

The code currently uses `Alien::Libtensorflow` which downloads the
pre-built library from Google <https://www.tensorflow.org/install/lang_c>
which has support for

 * Linux, 64-bit, x86
 * macOS, Version 10.12.6 (Sierra) or higher
 * Windows, 64-bit x86

all of which can be run using just the CPU. Note that at this time, the
latest version of TensorFlow (v2.11.0) only has built-in GPU support for
the Linux amd64 architecture (there are ways to use DirectML on Windows
and Metal for macOS as a PluggableDevice but I have not tried this yet
<https://www.tensorflow.org/install/gpu_plugins>). 

I have tried it with CUDA on Debian GNU/Linux and it has worked fine
(though it is a small bit of work to get all the components installed).
The requirements for GPU support are listed here
<https://www.tensorflow.org/install/pip#software_requirements>.

Per the pre-built CPU version that I have on Linux amd64, the highest
requirements for GLIBC and GLIBCXX are

  $ for ABI in GLIBC GLIBCXX; do echo -n "$ABI: "; readelf -sV $(perl 
-MAlien::Libtensorflow -e 'print grep /\Qlibtensorflow.so.2\E/, 
Alien::Libtensorflow->dynamic_libs')   | sed -n "s/.*@${ABI}_//p"  | sort  -V | 
tail -1; done
  GLIBC: 2.17 (23)
  GLIBCXX: 3.4.19 (17)

which you can check with

  $ ldd --version
  $ objdump -x /lib/x86_64-linux-gnu/libstdc++.so.6 | grep -P '^\s*\bGLIBCXX' | 
sort -u -V | tail -1


There is some preliminary support for building `libtensorflow` from
source in Alien::Libtensorflow, but it is not fully tested as the build
system that Google uses for TensorFlow is rather resource intensive and
prone to intermittent failures. These are pretty large shared library
files and can take well over an hour to build!

  $ du --total -h $(perl -MAlien::Libtensorflow -e 'print join "\n", 
Alien::Libtensorflow->dynamic_libs') | tail -1
  416M  total

The Docker images are built on top of the official CPU Docker images.
There are also official GPU Docker images which can be used with
`nvidia-docker` <https://github.com/NVIDIA/nvidia-docker>, but I
currently opted to not build Perl versions of those as they are quite a
bit larger than the CPU ones.

Hope that helps!

Best regards,
- Zaki Mughal

> 
> Regards,
> __
> Greg
> 
> Le mer. 1 févr. 2023 à 15:49, Zakariyya Mughal <zaki.mug...@gmail.com> a
> écrit :
> 
> > Hello,
> >
> > I have created some notebooks to demonstrate using the new libtensorflow
> > bindings <https://metacpan.org/pod/AI::TensorFlow::Libtensorflow>.
> >
> > The notebooks use PDL to convert the PDL ndarrays into the TensorFlow
> > TFTensor data structure. This is meant to be a low-level binding for now
> > and as such these conversions are not built into the binding.  Higher
> > level bindings on top of this are planned which will help with making it
> > easier to create new custom models and running inference on models.
> >
> > They are available as POD as linked from here <
> > https://metacpan.org/dist/AI-TensorFlow-Libtensorflow/view/lib/AI/TensorFlow/Libtensorflow/Manual/Quickstart.pod#TUTORIALS
> > >,
> > but it is best to view them in their source format at
> >
> > - Image classification demo <
> > https://nbviewer.org/github/EntropyOrg/perl-AI-TensorFlow-Libtensorflow/blob/master/notebook/InferenceUsingTFHubMobileNetV2Model.ipynb
> > >
> >
> > - Gene expression prediction demo <
> > https://nbviewer.org/github/EntropyOrg/perl-AI-TensorFlow-Libtensorflow/blob/master/notebook/InferenceUsingTFHubEnformerGeneExprPredModel.ipynb
> > >
> >
> > As described on the Quickstart page, the code dependencies to run these
> > notebooks are built as Docker images.
> >
> > Best regards,
> > - Zakariyya Mughal
> >
> >
> > _______________________________________________
> > pdl-general mailing list
> > pdl-general@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/pdl-general
> >


_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to