如果您喜欢该项目,请★明星此存储库以表示支持! ?
2024年1月15日 - 当我反思Spago的旅程时,我对它为我提供的丰富经历感到非常感激。通过Spago进行深入学习的基础,掌握GO并重新审视了巨大的回报。 Spago的独特功能,尤其是其异步计算图并专注于清洁编码,使其成为一个非凡的项目。我们的目标是在GO中创建一个极简主义的ML框架,从而通过启用独立可执行文件来消除对生产中对Python的依赖。 Spago的这种方法成功地在挑战性的生产环境中为我的几个项目提供了动力。
但是,将Spago提升到可以在不断发展的“ AI空间”中有效竞争的水平,该水平现在广泛涉及GPU上的计算,这需要实质性的承诺。同时,Spago渴望实现的愿景现在被Rust的蜡烛项目令人印象深刻。由于我将必要的关注能力有限,并且在没有支撑维护团队的情况下,我做出了务实的决定来暂停该项目。
我非常感谢Spago带我去的旅程和支持它的社区。随着我们继续探索不断发展的机器学习领域,我期待着令人兴奋的发展。
温暖的问候,
Matteo Grella
Spago是一个用Pure Go编写的机器学习库,旨在支持自然语言处理中的相关神经体系结构。
Spago是独立的,因为它使用自己的轻量级计算图进行训练和推理,从头到尾都易于理解。
它提供:
如果您对NLP相关的功能感兴趣,请务必探索塞伯伦包装!
要求:
克隆此存储库或获取图书馆:
go get -u github.com/nlpodyssey/spago一个好的起点是查看内置神经模型(例如LSTM)的实现。
这是如何计算两个变量总和的示例:
package main
import (
"fmt"
"log"
"github.com/nlpodyssey/spago/ag"
"github.com/nlpodyssey/spago/mat"
)
func main () {
// define the type of the elements in the tensors
type T = float32
// create a new node of type variable with a scalar
a := mat . Scalar ( T ( 2.0 ), mat . WithGrad ( true )) // create another node of type variable with a scalar
b := mat . Scalar ( T ( 5.0 ), mat . WithGrad ( true )) // create an addition operator (the calculation is actually performed here)
c := ag . Add ( a , b )
// print the result
fmt . Printf ( "c = %v (float%d) n " , c . Value (), c . Value (). Item (). BitSize ())
c . AccGrad ( mat . Scalar ( T ( 0.5 )))
if err := ag . Backward ( c ); err != nil {
log . Fatalf ( "error during Backward(): %v" , err )
}
fmt . Printf ( "ga = %v n " , a . Grad ())
fmt . Printf ( "gb = %v n " , b . Grad ())
}输出:
c = [7] (float32)
ga = [0.5]
gb = [0.5]这是感知公式的简单实现:
package main
import (
"fmt"
. "github.com/nlpodyssey/spago/ag"
"github.com/nlpodyssey/spago/mat"
)
func main () {
x := mat . Scalar ( - 0.8 )
w := mat . Scalar ( 0.4 )
b := mat . Scalar ( - 0.2 )
y := Sigmoid ( Add ( Mul ( w , x ), b ))
fmt . Printf ( "y = %0.3f n " , y . Value (). Item ())
}如果您认为缺少某些东西或可能会得到改善,请打开问题并提取请求。
要开始贡献,请检查贡献指南。
我们强烈鼓励您创建一个问题,因为它将有助于社区的发展。但是,如果您想私下与我们沟通,请随时向Matteo Grella发送任何问题或评论。