GithubHelp home page GithubHelp logo

Comments (16)

cesarsouza avatar cesarsouza commented on September 1, 2024 2

Hi @gmlwns2000,

Thanks for the comment and willingness to help!

I hadn't explicitly considered Xamarin in the roadmap of this project, but one thing that surely has been considered and will be implemented at some point is compliance to .NET Standard. Would a .NET Standard library be usable from Xamarin? If yes, then I guess Xamarin will be definitely supported.

Regarding whether porting Python code on a line-by-line basis is possible, I would say it is quite feasible most of the time, even though sometimes we might have to get creative with LINQ. But most of the time it works (in the worst case, we can just write helper methods to accomplish the same effect as the python code. However, one thing that is surely difficult is to determine what is the most general type that a variable in Python is going to contain during runtime, so we can use the same type in C#. Another thing is to handle variables that change types, as it is common in Python when doing argument validation. However, those can be addressed by using some conventions (i.e. adopting a naming convention for variables that have already been validated inside a method, and whose type should not change anymore).

@mdabros thanks, my main goal right now is to try to get as most people as possible interested in the project. I will not be able to commit much in the next 1-2 weeks because of a CVPR, but will surely retake the work later. In the meantime, please do not hesitate to spread the word about the project.

Regards,
Cesar

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024 1

Hi everyone,

I've just added some (crude) wiki page describing how one could contribute to the project by creating unit tests and making them pass.

I've started working on making the very first example pass (Issue #3), but so far I have already committed working examples to the following TensorFlow backend functions:

  • K.int_shape
  • K.ndim
  • K.random_normal
  • K.random_uniform
  • K.variable
  • K.zeros

If anybody would like to work in completing the TensorFlowSharp backends, please take a look at the wiki page I've just mentioned. Only a minimal knowledge of Python is necessary to complete those tasks.

Regards,
Cesar

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi @mdabros,

Thanks for opening the issue. In my answer below I will re-write some of the points that I had mentioned in the TensorFlowSharp issue here, just to make it easier for others who will come to this issue later.

The way I see, there are at least two almost separate lines of work that can be followed: The Keras engine, and the TensorFlowSharp backend.

  1. For the Keras engine, my plan of action was to develop it in a structural-risk-minimization-style way:

    I had marked the Keras commit I used as a base when converting the code above in a README.txt in the project's source folder. In order to make a test pass, it should be possible to go back to that commit and locate the Python code that should had been implemented by the code sections being covered by the test and check where they don't match. I guess this set of tasks would be more fit for people with experience with Python, Keras and C# but not necessarily TensorFlow/ TenslorFlowSharp.

  2. For the TensorFlowSharp backend: If anybody wants to proceed this way, it should be possible to start replacing some of the placeholder code at TensorFlowBackend.cs even if there are no current examples/unit tests that exercises them. I believe this would require more knowledge about TensorFlowSharp than Keras.

In both cases, I would recommend doing just as you mention: open an issue here to signal you are going to work on the issue, then send a pull-request. If you are going to try to implement one of Keras examples, you can start by posting it in the issue tracker, so other people can realize what exactly you are trying to implement.

Also, please note that the code is quite far from complete, and is not respecting the standard C#/.NET style in many places, especially regarding encapsulation. However, I think it would be better to ignore those style/encapsulation issues now in the beginning until we get most of the Python translation right. We will come back at them later.

Regards,
Cesar

from keras-sharp.

gmlwns2000 avatar gmlwns2000 commented on September 1, 2024

Hi guys.

Thank you for great starting @cesarsouza! I feel this project is good to work on. And so, I want to work on TensorFlowSharp backends.

And I have some opinion for developing roadmap.

First, I want to make this project as portable class library based on Xamarin.
Xamarin is wonderful toolkit to port and deploy c# application to everywhere. It increases accessibility of an application. (Code once, run everywhere. It's great!) So I think if keras on mobile, we could run amazing things on mobile too (inference, chatbot, and more deep learning tools) Also I already ported TensorFlowSharp to Xamarin (Win, Android, UWP).

Second, I am no idea to port python codes to c#, because I have no experience like that before. Does it line-by-line? I think line by line is the most convincing way as I think.

from keras-sharp.

mdabros avatar mdabros commented on September 1, 2024

@cesarsouza thanks for outlining the contribution procedure and plan of action. This will surely help to focus the effort.

I like your approach for porting the Keras engine. I also think this is the fastest and safest way to get some examples up and running.

I will try to help where ever it makes the most sense, with the goal of getting the examples to work. I should have a couple of days of spare time in the near future.

I agree on functionality first and C# .Net style later.

I really hope this will take-off in a good way :-).

from keras-sharp.

lobrien avatar lobrien commented on September 1, 2024

Aloha,

Just wanted to say that within the Xamarin team at Microsoft, we're very interested in AI and tools that can help democratize the technology. Personally I'm a big fan of Keras and am excited by this project, although there's clearly a lot of work ahead!

If there is any help I can provide answering questions re. Xamarin technologies, Visual Studio for Mac, etc., please feel free to ask.

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi @lobrien,

Thanks a lot for the positive feedback! However, as you correctly stated, there's lots of work ahead!

Regarding Xamarin, as I might have mentioned before, though, I have to say that achieving Xamarin compatibility out-of-the-box is not a current target for the project. This is something that should come out naturally once all the foundation stones are laid out.

Well, since you mentioned you could answer questions regarding Xamarin, actually I have one question to ask: I do not have much experience with Xamarin, but does it, or is it going to, offer support for .NET Standard 2.0 libraries out-of-the-box? If that's the case then I guess we will also have it covered because this should be certainly in the roadmap for this project.

Regards,
Cesar

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi everyone,

The first example unit test (Issue #3) is now passing, meaning that the basic execution flow for adding layers to a Sequential model should now be working. I am now adding more unit tests for other examples in the documentation.

By the way, if anybody who is willing to contribute would like some tips on how to port Python code from Keras, I just wanted to say that it is possible to install Keras (from git), TensorFlow (using pip3) and Spyder3 (from apt-get) in Bash for Windows 10.

Afterwards, if you have a X server/client also installed such as VcXsrv you will be able to launch Spyder3 and follow Keras' Python examples using a debugger, to see if the execution is indeed following the same code path.

Regards,
Cesar

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi everyone,

Just to give an update: the basic layers, loss functions, weight initializers have already been implemented in Keras Sharp. However, before we are able to get a model to train, it might be necessary to solve migueldeicaza/TensorFlowSharp#25 first. If anyone would like to help solving that issue in TensorFlowSharp repository, please feel free to jump in!

Regards,
Cesar

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Currently blocked by tensorflow/tensorflow#13190

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Until the TensorFlow/TensorFlowSharp issues are fixed, I've started adding support for CNTK instead.

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi everyone!

I just wanted to let you know that Keras# finally supports model training. There are a few issues (particular to TensorFlowSharp, CNTK, and even both) which are currently preventing more complex models from being trained right at this moment. However, since the main engine and most of the backend code for both CNTK and TensorFlow has already been ported, the project now allows users to train and evaluate MLPs - while it's certain that MLPs are no big deal for most machine learning frameworks right now, the main point is that those MLPs are being trained by a direct, line-by-line port of the Python Keras API into C#. This means we are currently supporting console status output, configurable metrics and switchable backends (for both CNTK and TensorFlow).

Even though only MLPs are supported for now, this update should serve as a validation that the main idea, i.e. bringing a line-by-line port of Keras to C#, is not only feasible, but it's one of the most extensibility-friendly routes that could have been adopted for development. Until a few days ago support for CNTK had barely been planned, but thanks to the knowledge laying in Keras-proven APIs, it could be added in almost no time.

If anyone is interested - please subscribe to (watch) the project's issue tracker for new issues. I will be adding new issues shortly describing areas that need further development, in order of priority.

Regards,
Cesar

from keras-sharp.

lydiae36 avatar lydiae36 commented on September 1, 2024

Hello,
I'm try your project, but developer environment is not OK....
How to create developer environment step by setp?
ex: visual studio version? How to install Accord、Keras Sharp、Tensorflow Sharp、CNTK?

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi @lydiae36,

Thanks a lot for the comment! There is a page detailing how to contribute to the project in the wiki. I've just updated it to include also instructions about how to clone and build the project for the first time.

Hope it helps! If you find a problem following the instructions please let me know so I can update it!

Regards,
Cesar

from keras-sharp.

lydiae36 avatar lydiae36 commented on September 1, 2024

Hi @cesarsouza

Development environment has been successfully created.
This is very helpful, thank you very much!
Written very detailed, very good!

In addition,
I want to use Keras-Sharp in Windows From
only Use the "hdf5" file to run predict
Is it estimated when will be completed "load_model" function?

from keras-sharp.

cesarsouza avatar cesarsouza commented on September 1, 2024

Hi @lydiae36,

Great! I am glad it has worked for you. Regarding the "load_model" function I am afraid it will take a bit more of time. Many operations are still not available in TensorFlow's C++ API and TensorFlowSharp yet (meaning they are a bit outside of my control at the moment).

However, if you could let me know which kind of model you are trying to implement, and if could provide me an example of the particular HDF5 file that you are trying to load into Keras#, I could start to shift development towards this goal and give more priority to this issue.

Regards,
Cesar

from keras-sharp.

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.