semvec/pypi-packages huggingface dataset:
sizif 0.0.7
Deep learning Keras models lifecycle management backup/restore nano framework


<image src="https://github.com/aristofun/sizif/raw/master/pic.png" align="right" width=240 />

# DL backup/restore nano framework

Auto backup/restore model snapshots of deep learning models:

- to/from local filesystem
- to/from remote FTP server

Current version supports only Keras >= 2.2 models. You're welcome to contribute.


# Usage

```commandline
pip3 install sizif
```

FTP Keras checkpoints backup/restore: 

```python
from sizif.keras import KerasModelWrapper
from sizif.storage import FTPFileCheckpointsMonitor

# your compiled Keras Model instance
model = build_model()  


# Local filesystem snapshots monitor with FTP backup/restore 
# Different model architectures should have different version parameter
# other parameters similar to Keras ModelCheckpoint
# See sizif.storage.FileCheckpointsMonitor for local file only backup/restore 
cpm = FTPFileCheckpointsMonitor(1,
                               'weights.{epoch:03d}-vl{val_loss:.3f}-va{val_acc:.3f}.hdf5',
                               local_folder='/snapshots_local_dir',
                               remote_folder='/snapshots_ftp_dir',
                               host='ftp.your-host.com', login='your_ftp_login',
                               password='your_ftp_password',
                               die_on_ftperrors=True,
                               rotate_number=3,
                               monitor='val_loss',
                               verbose=1,
                               save_best_only=False,
                               save_weights_only=True,
                               mode='auto',
                               period=1)

# Keras wrapper, proxies all calls to the model
# except `fit` and `fit_generator` — which are surrounded 
# by automated model state backup/recovery   
km = KerasModelWrapper(model, cpm)

# all method parameters are proxied to Keras as is except callbacks
# callbacks are extended with `cpm` listener 
km.fit_generator(training_set_generator,
                 epochs=25,
                 validation_data=test_set_generator,
                 callbacks=[tboard])
``` 

See sources for detailed docstrings

## TODO: 
- SSH/S3/Dropbox uploading monitors
- Tensorflow/Pytorch models support

## Tests

```commandline
python3 -m unittest 
```

## Dependencies
- numpy ~> 1.15
- Keras ~> 2.2

## License

This project is released under the MIT license.
powpy 0.1.1
A simple proof of work using SHA-256 hashes

# Proof of work
## A simple Proof Of Work module made with python

## **POW ALGORITHM**
The algorythm used in this module is very simple:
The inputs are an **initial SHA-256 hash** (that could be the last proof of work hash, like in bitcoin system) and a **difficult in number of zeroes**. That means the number of zeroes that the resulting hash must have at it's begining.

Starting with those two arguments, the script now makes a new random hash. That's the proof of work.
This new hash has to meet a condition:
1. The new hash is attached to the **initial hash**
2. The script now converts those two joint hashes (initial + new) into another hash. (Resulting hash)
3. If the resulting hash begins with the specified **number of zeroes**, the proof of work is valid.
4. The information returned is: (proof_of_work_hash, resulting_hash, number_of_attempts)
> Notice that the resulting hash may have more zeroes than the specified. The difficult is a **minimum**.

For curious people: [What is a proof of work?](https://en.wikipedia.org/wiki/Proof-of-work_system)

## **Other methods**
proof_of_work() is not the only method contained in this module. Here's an explanation of some others:
* **random_hash()**: Returns a random SHA-256 hash.
* **make_hash(string)**: Converts a string into a SHA-256 hash.

## **How to use it**
**From pip:** ```pip install powpy```
**From github repository:** Download and run setup.py