Registry / ai-ml / dynet
library2.1.2pypypiunverified

DyNet is the Dynamic Neural Network Toolkit, a C++ library with Python bindings for training neural networks, particularly focused on natural language processing. Current version 2.1.2 supports implicitly cast parameters as expressions, Python 3.8+, and advanced slicing. Release cadence is irregular.

pip install dynet
INSTALL
IMPORT
SIG · DYNET
D
dynet
ai-mlpythonv2.1.2
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
build_error
glibc
py 3.10–3.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dynet
✓ import dynet as dy
✗ from dynet import *
Wildcard imports pollute namespace; convention is to import as dy.
Model
✓ from dynet import Model
✗ import dynet.Model
dynet.Model is not a submodule; directly import the class.

Minimal example: create a model, parameters, and perform a simple optimization loop.

import dynet as dy model = dy.Model() trainer = dy.SimpleSGDTrainer(model) pW = model.add_parameters((2, 2)) pb = model.add_parameters(2) x = dy.vecInput(2) y = dy.scalarInput(0) for epoch in range(5): loss = dy.pickneglogsoftmax(pW.expr() * x, y) loss.backward() trainer.update() print(f"Epoch {epoch}: loss = {loss.value()}")
Debug
Known issues
gotchaIn DyNet 2.1, parameters are implicitly cast to expressions. Do not call `dy.parameter(p)` or `p.expr()`; just use `p` directly.
fix
Use `p` instead of `p.expr()` or `dy.parameter(p)`.
affects: >=2.1
breakingDyNet 2.0 removed dependency on Boost. Model files saved with v1.x are incompatible. You must re-train or convert models.
fix
Retrain models with v2.0+ or use a conversion script (if available).
affects: >=2.0
gotchaAlways call `dy.renew_cg()` before creating new computation graph nodes in a loop, otherwise memory usage grows unbounded.
fix
Call `dy.renew_cg()` at the start of each training iteration.
affects: all
Upgrade
Version history
2.1.2latest on PyPI · released Oct 21, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
dynet — pip install dynet · libregistry