Skip to main content

Nix Optimizer in PyTorch

Project description

Nix

Nix is an simple optimizer for optimize complex models. Nix是一个用于优化复杂模型的简单优化器。

Usage 使用

Here is example code 以下是示例代码:

from nixoptimiz import NixOptimizer
import torch
from torch import nn

# Example Model
model = nn.Sequential(
    nn.Linear(16, 512),
    nn.ReLU(),
    nn.Linear(512, 16),
    nn.Sigmoid()
).cuda()

# Example Data
inputs = torch.randn(64, 16).cuda()
outputs = torch.rand(64, 16).cuda()

optim = NixOptimizer(model.parameters(), lr=0.01, muon_mode="kernel")
criterion = nn.BCELoss()

for idx in range(0, 5001):
    loss = criterion(model(inputs), outputs)
    optim.zero_grad()
    loss.backward()
    optim.step()
    if idx % 100 == 0:
        print(f"Train step: {idx}, Loss: {float(loss.cpu())}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nixoptimiz-0.1.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file nixoptimiz-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nixoptimiz-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for nixoptimiz-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f38cb69a4193e10a39c60a158046a5092417ba3e09c6e8136c155d13558ce2ef
MD5 0ff5e9755f587d79de22def8b0d78a77
BLAKE2b-256 26567656003260180ff576ddb6fa17984e120e3d77b99e38660fc8f0862f615e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page