semvec/pypi-packages huggingface dataset:
wilson3d 0.4.1
Tool to create animation files for Wilson
License: MIT
Requires Python: >=3.8
Keywords: 3D,visualization

# Wilson Python Package

Python package for creating Wilson animations. See `notebooks` folder for example.

## Usage

A simple example for creating an animation:

```python
import numpy as np
import wilson

r = 5.0
t = np.linspace(0, 2*np.pi)
x = r * np.cos(t)
y = r * np.sin(t)
z = np.zeros_like(t)

path = np.column_stack((t, x, y, z))
orbit = wilson.Path(path, name='Moon Orbit')

earth = wilson.Sphere('Earth', description="That's our planet!", radius=1.0, color='blue')
moon = wilson.Sphere('Moon', description='Our oldest pal!', radius=0.27, color='grey')
moon.position = orbit

project = wilson.Project('Earth Moon',
    author='wilson',
    description='The Moon orbiting around the Earth.',
    animationSpeed=2*np.pi / 5.0,
    animatables=[earth, moon])

wilson.saveProject(project, '../examples/earth_moon.wlsn')
```

## Known Issues

Parsing a project and immediately serializing it again might produce a different
result. This is due to protobuf returning default values for missing properties
of a built-in type (i.e. string, float, etc.).

While it is possible to circumvent this, it would bloat the protobuf files and
was thus not done.

## TODO

The package lacks early type check which might makes debugging software using a
bit more tedious. Nevertheless, the output is guaranteed to meet the protocol as
this is assured by protobuf.
retentive-network 0.1.0
Unofficial codebase for the "Retentive Network: A Successor to Transformer for Large Language Models" paper [https://arxiv.org/pdf/2307.08621.pdf]
License: MIT
Requires Python: >=3.9,<4.0

# RetentiveNetwork
Unofficial codebase for the "Retentive Network: A Successor to Transformer for Large Language Models" paper [https://arxiv.org/pdf/2307.08621.pdf]

The official codebase for RetNet should be made available roughly August 1st, 2023 according to Microsoft here: 

* [https://github.com/microsoft/unilm/tree/master/retnet](https://github.com/microsoft/unilm/tree/master/retnet)
* [https://github.com/microsoft/torchscale](https://github.com/microsoft/torchscale)


## Getting Started

This library can be installed using pip.

```
pip install retentive-network

```

## Example Training

The paper provides three forward passes which can all be used to train this model. However,
the `forward()` and `forward_chunkwise()` are recommended for sample data and sample data 
with long sequences respectively. The `forward_recurrent()` method, while it can be used for
training, the authors suggest using it for faster inference instead.

[example-training-script](https://github.com/zbloss/RetentiveNetwork/blob/main/examples/example_training.py)

```python

import torch
from retentive_network.models.clm import RetentiveNetworkCLM

batch_size = 8
sequence_length = 5
hidden_size = 32
number_of_heads = 4
number_of_layers = 4
feed_forward_size = 20
chunk_size = 2
samples = 100
vocab_size = 100

sample_data = torch.randint(0, vocab_size, (samples, batch_size, sequence_length))
labels = torch.randint(0, sequence_length, (samples,batch_size))

model = RetentiveNetworkCLM(
    number_of_layers=number_of_layers,
    hidden_size=hidden_size,
    number_of_heads=number_of_heads,
    feed_forward_size=feed_forward_size,
    vocab_size=vocab_size,
    chunk_size=chunk_size,
    softmax=True
)


optimizer = torch.optim.AdamW(model.parameters(), lr=1e-3)
criterion = torch.nn.CrossEntropyLoss()

initial_out = model(sample_data[0])
initial_loss = criterion(initial_out, labels[0])

for sample, label in zip(sample_data, labels):
    optimizer.zero_grad()

    out = model(sample)
    loss = criterion(out, label)
    loss.backward()
    optimizer.step()



```