0.0.4-dev • Published 3 months ago

@soteen/bela v0.0.4-dev

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Banner

BELA is an AI architecture that represents text using binary, leverages entropy for learning, and two-way prediction to create response.

BELA itself stands for Binary Entropy Learning Architecture.

Tutorials

If you want to learn how to install and use BELA, you can follow the tutorial we provide.

Installation

You can install BELA using npm with this command.

npm install @soteen/bela

Next steps after installation

Here's a quick setup to start training your own AI model with BELA. 1. Creating a configuration:

You need a configuration to configure the model you want to create.
```json5
{
  "parameter": {
    "epochs": 5, // Number of training iterations
    "learningRate": 0.05, // Learning rate for optimization
    "nGramOrder": 3, // Context window size for text processing
    "layers": [64, 32, 16] // Neural network layer sizes
  },
  "path": {
    "root": "./", // Base directory
    "model": "./models/", // Model storage path
    "backup": "./backup/" // Backup directory
  },
  "autoIncrement": true, // Automatic upgrade
  "autoDelete": true, // Delete old versions automatically
  "autoDeleteMax": 2 // Number of versions stored, oldest will be deleted
}
```
  1. Creating a dataset:

    Before proceeding to the next step, you need to create a dataset as follows.

    [
      { "input": "Hey, how are you?", "output": "I'm fine, thank you?"},
      { "input": "Tell me about the story", "output": "Sure! I'll tell you about the story" }
    ]
  2. Use the code examples:
    After installing, creating configurations, and creating datasets. You can run the following codes.

    3.1. **Import** ``@soteen/bela`` **to the project**:
    ```javascript
    import { BELA } from "@soteen/bela";
    ```
    3.2. **Initialize BELA with the configuration**:
    ```javascript
    const model = new BELA(config);
    ```
    3.3. **Train the model with the dataset**:
    ```javascript
    model.train(dataset);
    ```
    3.4. **Save the trained model**:
    ```javascript
    /** No auto-increment */
    model.save("model.belamodel", {
      password: password
    });
    
    /** With auto-increment */
    model.save("model", {
      password: password
    });
    ```
    3.5. **Load the trained model**:
    ```javascript
    /** No auto-increment */
    model.load("model.belamodel", {
      password: password
    });
    
    /** With auto-increment */
    model.load("model", {
      password: password
    });
    ```
    3.6. **Move model to new/other file**:
    ```javascript
    /** No auto-increment */
    model.move("old-model.belamodel", {
      password: oldPassword
    },
    "new-model.belamodel", {
      password: newPassword
    });
    
    /** With auto-increment */
    model.move("old-model", {
      password: oldPassword
    },
    "new-model", {
      password: newPassword
    });
    ```
    3.7. **Read the contents of the** ``.belamodel`` **file**:
    ```javascript
    /** No auto-increment */
    console.log(model.read("model.belamodel", {
      password: password
    }));
    
    /** With auto-increment */
    console.log(model.read("model", {
      password: password
    }));
    ```
    3.8. **Make a prediction**:
    ```javascript
    const predict = model.predict("Say this is example code.", {
      maxLength: 12,
      maxTest: 5,
      logTest: true
    });
    
    console.log(predict);
    ```

    !CAUTION We recommend that you store your configuration in a JSON file and your model password in a .env file.

Installation Performance

From version to version, BELA has installation differences that we can see in the following table. | Version | Size | Performance | Optimizations performed | |------------|---------|-------------|-------------------------| | v0.0.4-dev | 64.62kB | 5s | Build and minify using esbuild | | v0.0.3-dev | 69.25kB | 4-8s | Deleting .js.map files | | v0.0.2-dev | 83.09kB | 4-8s | Nothing | | v0.0.1-dev | 83.16kB | 4-8s | Nothing |

This data is obtained by extracting the .tgz file from each version, after which its size is obtained through the process of checking the size of its folder. This data does not include the dependencies.

Contribute

If you haven't contributed yet, you should read how to contribute to this project.

Roadmap

This project has several roadmaps that we have achieved and have not achieved.

  • Compatible with CommonJS and ES Modules.
  • Introducing the move() feature.
  • Introducing the read() feature.
  • Introducing the fineTune() feature.
  • Introducing the security of the .belamodel feature.
    And others...
0.0.4-dev

3 months ago

0.0.3-dev

4 months ago

0.0.2-dev

5 months ago

0.0.1-dev

5 months ago