DEV Community

Cover image for DEM: creating more accessible artificial intelligence
Diego Vallejo
Diego Vallejo

Posted on

DEM: creating more accessible artificial intelligence

I have always been fascinated by the concept of creativity, for that reason I entered the world of programming, your first hello world feels like something magical, and I thought that the same sensation would not be repeated, but they told me about the concept of "Creative Tools" and how they would be able to create making their own decisions ... without a doubt I was fascinated by the idea and started trying to create something similar from home

Back in 2018 I started an Ai model called JNFR it was similar to modern NLP tools like OPENAI's transformers, but of course it had less parameters, it's main goal was to learn some simple language structure, and after that I started to work on "diabolus ex machina" (a creepy yet cool name), a recurrent Ai model that has a much bigger structure than the previous one. In this project I wanted to learn what could be a successful architecture for a modern language model, and I learned a lot from this experience, I had to manage a lot of parameters and tasks and every time one of my model would learn something new I had to re-think my architecture. I learned a lot thanks to this experience, but I also learnt that I needed to have a generalist tool, a tool that could create new models from raw data and train them with any kind of architecture. This has been the base of everything that I have been working on since then, I have learned a lot in all the projects that I have done but this one was the most important one, it helped me to establish a strong base from which I could develop my own tools and solve any problem that I have to face.

So, what is this new project, what have I been doing the last 3 months and what is going to happen next?

What is JNFR?

The project is called JNFR. Why? Because it is a tribute name to a person who inspired me to create it, I changed it's name to "diabolus ex machina" in the major version upgrade

My goal with this project is to simplify the creation of NLP models, I want to provide a tool that can be used by any developer to build and train a model using a simple interface, the same interface that is going to be used to create the model itself.

How does it work?

The DEMlibrary can be used to create a model from raw data, the library will do all the heavy lifting for you, it will read the data, tokenize the sentences, build a vocabulary from the tokens and it will create a model from the raw data using an architecture that you will provide.

This is some code from my first version of DEM, this code reads a file, tokenizes it and creates an NLP model using the provided architecture.

// Read the input data 
DataInputStream = new DataInputStream("path/to/the/input/data/file");
// Tokenize the data into sentences Tokenizer
tokenizer = new Tokenizer( in );
sentenceTokenizer = new StringTokenizer(tokenizer.getTokens(), " ", TAB_SEPARATOR);
// Create the vocabulary from the sentences Vocabulary 
vocabulary = new VocabularyBuilder(tokenizer, sentenceTokenizer).build();
// Create the model from the Tokenized data GraphBuilder 
graphBuilder = new GraphBuilder();
graphBuilder.addUnlabeled(vocabulary);
graphBuilder.add(new NN(1, 0, 0));
// Train the model with the provided Architecture 
GraphBuilder.Train train = graphBuilder.train(); // Optionally save the model to disk
FileModel.save(graphBuilder.getGraph());
Enter fullscreen mode Exit fullscreen mode

This is how you can create a model using the DEM library.
YES the neural network and the NLP module are encapsulated
graphBuilder.add (new NN (... params))
graphBuilder is a higher order object to control the given model and converts the tokens into unrepeatable and immutable floating values ​​to new word changes eg token "word": .75240517 something like mini AI-byte-size hash

What is DEM doing right now?

I have been working the last 3 months on this library, I have created a lot of documentation and I have been focusing on the first version of the library, I want to have a stable version before I announce it to the world, this library will be open-source and I want to have a lot of people using it, I want to have a community where I can learn from everyone and I want everyone to learn from me.

I have created some test models using this library, the most important one is a simple language model that has been used to generate a song, I have been working on this model for a while and I am almost done with it.

I have created a lot of tests for this library and I have been working on a nice web interface for it, and now I am working on the last things that I want to do, I want to have a stable first version before I announce it to the world and I want to have a nice web interface for it, I have been working a lot on this interface and I have been able to create a lot of things with it, I have already exposed my API to the internet and I have used it to create a model in real time, I have used it in a web application, in a mobile application and I have used it in a program that I am writing. I have written a lot of documentation about this library and I have created a lot of tests, I have solved a lot of bugs and I have used this library for a lot of different problems, I want to have a stable version before I announce it to the world, I will wait a little bit more and then I will make a new post about it.

What is going to happen next?

I am going to finish this project and I am going to release it, I am going to use it to create a lot of different things and I am going to make a lot of posts about it, I will start a series of posts about this library and I am going to create a new section on this website to show everything that I have done with it.

This project has been a lot of work for me, I have learned a lot and I have done a lot of things, I have created a lot of tests, I have solved a lot of bugs and I have used this library for a lot of different problems.

If you want to use this library soon you could download it from my github and maybe as an NPM package

Stay tuned!

Top comments (0)