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.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nixoptimiz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac674c38f0966a0924274a45f9ebcf3465dc86b607962a8e41d5cd7e39665032
MD5 4737da63836041fc5097a332ae41db00
BLAKE2b-256 f010720ec6ae597883dccd7a6f5b85fa398976a3670f3497dbf67287c0ed0ad1

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