cocoa-xu / tflite_beam Goto Github PK
View Code? Open in Web Editor NEWTensorFlow Lite Erlang bindings with optional EdgeTPU support.
License: Apache License 2.0
TensorFlow Lite Erlang bindings with optional EdgeTPU support.
License: Apache License 2.0
any reason they are not precompiled presently?
tflite_elixir seems to have armv6 support..
It's rare but I found that it sometimes causes segfaults in the GitHub CI.
https://github.com/cocoa-xu/tflite_elixir/actions/runs/4405411900/jobs/7716261476
Use a TensorFlow Lite model to answer questions based on the content of a given passage.
BasicTokenizer
WordpieceTokenizer
FullTokenizer
related link: https://www.tensorflow.org/lite/examples/bert_qa/overview
This is rather a question about accessing tensor fields.
As I play with the Super Resolution example, I notice there are two ways to access shape and type of a tensor and they seem to give the same result at least in the context of the example. I am wondering if there is a case where we have to use the functions. Depending on it, we might need to explain in the doc or to consider deprecating the functions.
out_tensor.shape
# vs
TFLite.TFLiteTensor.dims(out_tensor)
out_tensor.type
# vs
type = TFLite.TFLiteTensor.type(out_tensor)
Here are a list of blank documents as of 2023-03-14
module docs
function docs
When TFLiteTensor.to_nx/2
is called without Nx backend provided, a cryptic error can occur. I am wondering if there is a way to make this error less cryptic and/or to print a human friendly error message.
https://hexdocs.pm/tflite_elixir/TFLiteElixir.TFLiteTensor.html#to_nx/2
The error seems to occur when Nx.from_binary/3
is called.
https://hexdocs.pm/nx/Nx.html#from_binary/3
** (UndefinedFunctionError) function nil.from_binary/3 is undefined
nil.from_binary(#Inspect.Error<
got KeyError with message:
"""
key :__struct__ not found in: nil. If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
"""
while inspecting:
%{__struct__: Nx.Tensor, data: nil, names: [nil], shape: {100}, type: {:f, 32}}
Stacktrace:
(nx 0.5.1) lib/nx/tensor.ex:165: Inspect.Nx.Tensor.inspect/2
(elixir 1.14.3) lib/inspect/algebra.ex:341: Inspect.Algebra.to_doc/2
(elixir 1.14.3) lib/kernel.ex:2254: Kernel.inspect/2
(elixir 1.14.3) lib/exception.ex:717: anonymous fn/2 in Exception.format_arity/1
(elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir 1.14.3) lib/exception.ex:717: Exception.format_arity/1
(elixir 1.14.3) lib/exception.ex:712: Exception.format_mfa/3
(elixir 1.14.3) lib/exception.ex:623: Exception.format_stacktrace_entry/1
>, <<105, 9, 17, 64, 151, 171, 24, 191, 192, 69, 116, 62, 25, 75, 60, 63, 192, 10, 3, 192, 114, 80, 4, 63, 114, 80, 4, 64, 16, 4, 201, 63, 36, 209, 246, 63, 154, 234, 95, 191, 79, 52, 183, 190, 79, 52, 183, 190, 7, 189, ...>>, [])
(tflite_elixir 0.1.5) lib/tflite_elixir/tflite_tensor.ex:124: TFLiteElixir.TFLiteTensor.to_nx/2
This error can be recreated just by removing :backend
option in the examples/artistic_style_transfer.livemd notebook.
Right now we have something like
Nx.tensor([1, 2, 3])
|> Nx.to_binary()
|> then(&TFTensor.set_data!(input_tensor, &1))
the goal is to do the same thing without explicitly calling to_binary/from_binary
(maybe also include some other functions).
tensor = Nx.tensor([1, 2, 3])
tf_tensor = Nx.backend_transfer(tensor, TFLite.Backend)
TFLite.run(model, tf_tensor)
#=> This will also return a tensor allocated on TFLite.Backend
tensor = Nx.tensor([1, 2, 3])
TFLite.run(model, tensor)
Hi. I wanted to try it with coral but my livebook dies on the last cell in the tpu.livemd
I tried to run it as mix task but also getting
[1] 55100 segmentation fault (core dumped) mix classify_image -m /tmp/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflit
I have the coredump but it's 175MB in size
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.