qeep is a deep learning framework designed for the Go programming language. It enables users to build and train neural networks through a declarative API while providing advanced features like multi-dimensional tensors, automatic differentiation, and GPU acceleration for optimizing performance in large-scale computations.
qeep is an innovative deep learning framework built using Go that empowers users to define and implement neural networks through a declarative approach, while offering granular control at the tensor level. Designed for flexibility and performance, this framework brings several key features to support deep learning tasks.
FC) layers, to build complex models efficiently.stream package, simplifying the model definition process.The repository includes comprehensive usage examples for various deep learning tasks. Below is a snippet demonstrating how to define a classification model:
package main
import (
"github.com/sahandsafizadeh/qeep/component/layers"
"github.com/sahandsafizadeh/qeep/component/layers/activations"
"github.com/sahandsafizadeh/qeep/component/losses"
"github.com/sahandsafizadeh/qeep/component/optimizers"
"github.com/sahandsafizadeh/qeep/model"
"github.com/sahandsafizadeh/qeep/model/stream"
"github.com/sahandsafizadeh/qeep/tensor"
)
const dev = tensor.CPU
func prepareModel() (m *model.Model, err error) {
input := stream.Input()
x := stream.FC(&layers.FCConfig{Inputs: 4, Outputs: 16, Device: dev})(input)
x = stream.Relu()(x)
x = stream.Dropout(&layers.DropoutConfig{Rate: 0.3})(x)
x = stream.FC(&layers.FCConfig{Inputs: 16, Outputs: 3, Device: dev})(x)
output := stream.Softmax(&activations.SoftmaxConfig{Dim: 1})(x)
/* -------------------- */
loss := losses.NewCE()
optimizer, err := optimizers.NewAdamW(&optimizers.AdamWConfig{
LearningRate: 1e-5,
WeightDecay: optimizers.AdamWDefaultWeightDecay,
Beta1: optimizers.AdamWDefaultBeta1,
Beta2: optimizers.AdamWDefaultBeta2,
Eps: optimizers.AdamWDefaultEps,
})
if err != nil {
return
}
m, err = model.NewModel(input, output, &model.ModelConfig{
Loss: loss,
Optimizer: optimizer,
})
if err != nil {
return
}
return m, nil
}
Additional practical examples are available for reference. To run the Iris Classification example, use the following command:
cd ./qeep/examples/03-Iris/
curl -o data.csv https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
go run .
To harness the power of GPU, follow these prerequisites:
gcc.Once setup, build the required CUDA libraries:
cd ./qeep
make cuda
Finally, set the tensor device to CUDA and run your program using the cuda build tag:
go run -tags=cuda .
With qeep, the endeavor of deep learning becomes more approachable and efficient, making it an essential tool for developers and researchers working in the field.
No comments yet.
Sign in to be the first to comment.