semvec/pypi-packages huggingface dataset:
kv-fs 0.1.18
Key-Value DB API on the filesystem
Requires Python: >=3.10

# Key-Value: Filesystem

> Implementation of the `KV[T]`async Key-Value ABC, on the filesystem

```bash
pip install kv-fs
```

## Usage

### Already serialized data (`str` or `bytes`)

```python
from kv.fs import FilesystemKV

data = FilesystemKV[bytes]('path/to/data')
# and then use it as you'd a KV[bytes]
```

### Custom serialization

```python
from kv.fs import FilesystemKV, InvalidData
from haskellian import Either, Left, Right
import json

def safe_parse(x: bytes) -> Either[InvalidData, dict]:
  try:
    return Right(json.loads(x))
  except Exception as e:
    return Left(InvalidData(e))

data = FilesystemKV[dict](
  base_path='path',
  extension='.json',
  dump=json.dumps,
  parse=safe_parse
)
# and then use it as you'd a KV[dict]
```

### Pydantic-validated types

```python
from kv.fs import FilesystemKV, InvalidData

kv = FilesystemKV.validated(tuple[str, int], 'path/to/data') # any JSON/pydantic serializable type should work
# and then use it as you'd a KV[tuple[str, int]]

await kv.read('key-with-invalid-data') # Left(InvalidData(ValidationError(...))
```

## `AppendableKV[T]`

```python
from kv.fs import FilesystemAppendKV

kv = FilesystemKV.validated(tuple[str, int], 'path/to/data') # stores data as ndjson
await kv.append('key', [('first', 1), ('second', 2)])
```
netra-adapter 0.1.5
A package for managing LoRA adapters in language models ideal for hotswapping
Requires Python: >=3.6

# Netra Adapters

`Netra Adapter` is a Python package designed to dynamically load and integrate Low-Rank Adaptation (LoRA) weights into transformer models, facilitating fine-tuned performance for various tasks.

## Features

- Load LoRA adapter weights from local files or directly from the Hugging Face Hub.
- Dynamically integrate and remove adapter weights based on query content.
- Generate responses using integrated LoRA weights.

## Installation

To install the `netra_adapter` package, clone this repository and install the dependencies:

```bash
pip install netra_adapter
```


## Example Usage

### Importing and Initializing

First, import the necessary modules and initialize the `LoRAAdapterManager` with the desired model:

```python
from netra_adapter import LoRAAdapterManager
import torch

# Determine the device to use (GPU or CPU)
device = 'cuda' if torch.cuda.is_available() else 'cpu'

# Instantiate the LoRAAdapterManager with a specified model
adapter_manager = LoRAAdapterManager(model_name='gpt2', device=device)

# Load LoRA weights from the Hugging Face Hub
adapter_manager.load_lora_weights(adapter_name='sales', filepath_or_repo='AdapterHub/gpt2_sales')
adapter_manager.load_lora_weights(adapter_name='support', filepath_or_repo='AdapterHub/gpt2_support')

# Function to generate a response based on query content
def generate_adaptive_response(query):
    adapter_name = None
    if 'sales' in query.lower():
        adapter_name = 'sales'
    elif 'support' in query.lower():
        adapter_name = 'support'
    else:
        return "Query does not match any adapter criteria."

    # Integrate the selected LoRA weights
    adapter_manager.integrate_lora_weights(adapter_name)
    
    # Generate the response with the integrated LoRA weights
    response = adapter_manager.generate_response(query)
    
    # Remove the integrated adapter hooks to reset the model
    adapter_manager.remove_adapter_hooks(adapter_name)
    
    return response
# Example queries
query_sales = "Can you provide me with the sales report for Q1?"
query_support = "I need help with my account, it doesn't login."

# Generate adaptive responses
response_sales = generate_adaptive_response(query_sales)
print("Sales query response:", response_sales)
print('#' * 100)
response_support = generate_adaptive_response(query_support)
print("Support query response:", response_support)

```
text-emotion-description 0.3
A Python package for emotion detection using neural networks
Requires Python: >=3.6

# emotion_description

emotion_description is a Python project that detects the emotion of text utilizing a neural network.


## Installation

```bash
pip install pandas
pip install numpy
pip install seaborn
pip install matplotlib
pip install nltk
pip install scikit-learn
pip install tensorflow
pip install keras
pip install pickle 
```

## Usage

```python
python main.py
```

## Contributing
Contributions to this project were made by Ankith Manchale and Debanshu Ganguly. Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


## Liscence
Ankith License with Attribution

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software with attribution to the author, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

Attribution to the author must be prominently displayed in any
publications, distributions, or derivative works of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
graph-tools 1.14
tools for graph theory and network science with many generation models

# graph-tools Package

graph_tools - tools for graph theory and network science with many generation models

# DESCRIPTION

This manual page documents **graph-tools** module, a Python module that
provides a number of features for handling directed/undirected graphs and
complex networks.  **graph-tools** was initially developed for networking
researchers, who perform experiments in the field of graph theory and network
science.  **graph-tools** provides Graph class, which supports both directed
and undirected graphs with multi-edges, vertex weights, edge weights, and
graph attributes.  A number of graph/network generation models and graph
algorithms are supported.

Major features of **graph-tools** are:

- directed/undirected graph with multi-edges, vertex weights, edge weights,
  and graph attributes
  
- vertex operations (add, delete, degree, neighbors, random vertex, and
  set/get vertex attributes)

- edge operations (add, delete, random edge, and set/get edge attributes)

- graph operations (copy, adjacency matrix, diagonal matrix, Laplacian matrix)

- major graph algorithms (exploration, connectivity, components, maximal
  component, Dijkstra, Floyd-Warshall, betweenness centrality)

- spectral graph theory (spectral radius, spectral gap, natural connectivity,
  algebraic connectivity, effective_resistance, and spanning tree count)

- a number of graph/network generation models (random graph, ER (Erdos Renyi),
  BA (Barabasi Albert), randomized BA, ring, tree, binary tree, BA tree,
  generalized BA, latent, lattice, Voronoi, DB (Degree Bounded), configuration
  model, random regular graph, Li-Miani graph)

- graph import/export in DOT (GraphViz) format

# HISTORY

The development of **graph-tools** started in 2007, which was initially an
extension to Graph module in CPAN (Comprehensive Perl Archive Network) by
Jarkko Hietaniemi.  Our Perl module has been called **graphtools** for long
time and Perl module names were Graph::Util and Graph::Enhanced.
**graphtools** in Perl has been developed until 2018.  Python version of
**graph-tools** was born in 2018 by porting **graphtools** in Perl to Python.
Hence, the internal structure and the coding style receives significant
influence from Graph module by Jarkko Hietaniemi.

# EXAMPLE

```python
from graph_tools import Graph

# create a graph with four nodes and two edges
g = Graph(directed=True)
g.add_edge(1, 2)
g.add_edge(2, 3)
g.add_vertex(4)
print(g)

# find the all shortest paths from vertex 1
dist, prev = g.dijkstra(1)
print(dist)

# generate BA graph with 100 vertices
g = Graph(directed=False).create_graph('barabasi', 100)

# check if all vertices are mutually connected
print(g.is_connected())

# compute the betweenness centrality of vertex 1
print(g.betweenness(1))
```

# INSTALLATION

```python
pip3 install graph-tools
```

# AVAILABILITY

The latest version of **graph-tools** module is available at PyPI
(https://pypi.org/project/graph-tools/) .

# SEE ALSO

graphviz - graph visualization software (https://graphviz.org/)

# AUTHOR

Hiroyuki Ohsaki <ohsaki[atmark]lsnl.jp>
global-names 0.0.2
Human Names for Synthetic Data Generation
Requires Python: >=3.8

Global Names
=============

## Overview

This repository contains a collection of name datasets gathered from multiple sources, including government records, historical documents, and public databases. The data has been cleaned, standardized, and organized to facilitate easy use in data science projects, demographic studies, and name-related research.

## Features

- **Extensive Name Collection**: A wide range of first and last names from multiple countries and cultures.
- **Python Tools**: Utilities and scripts to efficiently work with the name datasets.
- **Easy Integration**: Simple and intuitive integration with your Python projects.
- **Open Source**: Released under the MIT License, allowing for free use and distribution.

## Installation

To use global_names in your project, you can install from PyPI using pip.

```bash
pip install global-names
```

### Install from source

```bash
git clone https://github.com/DecisionNerd/global_names
cd global_names
pip install -r requirements.txt
```

## Usage

### Loading the Datasets

You can easily load the name datasets using the provided Python tools. Below is an example of how to load and use the data.

```python
import pandas as pd

# Load last names from a specific country
last_names_df = pd.read_csv('data/last_names/usa.csv')

# Display the first few entries
print(last_names_df.head())
```

### Searching for a Name

The tools provided also include functionality to search for specific names within the datasets.

```python
from tools import name_search

# Search for a specific last name
results = name_search.search_last_name('Smith', 'usa')
print(results)
```

### Generating Random Names

You can also generate random names using the datasets for purposes such as testing or anonymizing data.

```python
from tools import name_generator

# Generate a random full name
random_name = name_generator.generate_random_name('usa')
print(random_name)
```

## Contributing

We welcome contributions from the community! If you would like to contribute, please follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or bugfix.
3. Make your changes.
4. Submit a pull request with a detailed description of your changes.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Acknowledgements

A big thank you to Matthew Hager [smashew](https://github.com/smashew) for his original work on the text databases of last names. This project builds upon the foundation he created.

A thank you to Philippe Rémy [philipperemy](https://github.com/philipperemy) for posting the username dataset.  While Philippe's work is not integrated into this project, his data preparation has greatly accelerated our work on NamesData.

## Contact

For any questions or suggestions, feel free to open an issue or start a discussion thread or contact us at hello@frontieranalytica.com.
tinystoriesmodel 0.1.4.post9
A small TinyStories LM with SAEs and transcoders
Requires Python: <4.0,>=3.11

# [TinyModel](https://github.com/noanabeshima/tiny_model)
TinyModel is a 4 layer, 44M parameter model trained on [TinyStories V2](https://arxiv.org/abs/2305.07759) for mechanistic interpretability. It uses ReLU activations and no layernorms. It comes with trained SAEs and transcoders.

It can be installed with `pip install tinystoriesmodel`


```
from tiny_model import TinyModel, tokenizer

lm = TinyModel()

# for inference
tok_ids, attn_mask = tokenizer(['Once upon a time', 'In the forest'])
logprobs = lm(tok_ids)

# Get SAE/transcoder acts
# See 'SAEs/Transcoders' section for more information.
feature_acts = lm['M1N123'](tok_ids)
all_feat_acts = lm['M2'](tok_ids)

# Generation
lm.generate('Once upon a time, Ada was happily walking through a magical forest with')

# To decode tok_ids you can use
tokenizer.decode(tok_ids)
```

It was trained for 3 epochs on a [preprocessed version of TinyStoriesV2](https://huggingface.co/datasets/noanabeshima/TinyStoriesV2). Pre-tokenized dataset [here](https://huggingface.co/datasets/noanabeshima/TinyModelTokIds). I recommend using this dataset for getting SAE/transcoder activations.



# SAEs/transcoders
Some sparse SAEs/transcoders are provided along with the model.

For example, `acts = lm['M2N100'](tok_ids)`

To get sparse acts, choose which part of the transformer block you want to look at (currently [sparse MLP](https://www.lesswrong.com/posts/MXabwqMwo3rkGqEW8/sparse-mlp-distillation)/[transcoder](https://www.alignmentforum.org/posts/YmkjnWtZGLbHRbzrP/transcoders-enable-fine-grained-interpretable-circuit) and SAEs on attention out are available, under the tags `'M'` and `'A'` respectively). Residual stream and MLP out SAEs exist, they just haven't been added yet, bug me on e.g. Twitter if you want this to happen fast.

Then, add the layer. A sparse MLP at layer 2 would be `'M2'`.
Finally, optionally add a particular neuron. For example `'M0N10000'`.

# Tokenization
Tokenization is done as follows:
- the top-10K most frequent tokens using the GPT-NeoX tokenizer are selected and sorted by frequency.
- To tokenize a document, first tokenize with the GPT-NeoX tokenizer. Then replace tokens not in the top 10K tokens with a special \[UNK\] token id. All token ids are then mapped to be between 1 and 10K, roughly sorted from most frequent to least.
- Finally, prepend the document with a [BEGIN] token id.
Fast-Temp-mail-Creator 0.1.0
Library for creating and managing temporary email accounts with mail.tm API.
Requires Python: >=3.6

# Fast-Email

Library for creating and managing temporary email accounts with the mail.tm API.

## Installation

You can install the library using `pip`:

```bash
pip install Fast-Email
```

# Usage
## Get available domains

```bash
domains = Lmi.domains()
print(f"Available domains: {domains}")
```
## Register a new account

```bash
new_account = Lmi.register()
print(f"Registered account: {new_account}")
```
## Get an authentication token

```bash
token = Lmi.get_token(new_account['email'], new_account['password'])
print(f"Authentication token: {token}")
```
## Get email messages

```bash
messages = Lmi.get_sms(token)
print(f"Messages: {messages}")
```
BioProps 0.1.0
A Python library for computing properties of cell nuclei and colonies from NIfTI files, enabling analysis of cellular structures in medical images.
Requires Python: >=3.6

# BioProps

BioProps is a Python library for computing properties from medical images, particularly for analyzing cell nuclei and colonies in 3D space. It provides functions to calculate properties such as elongation, flatness, volume, size, and edge lengths from NIfTI files representing binary cell data.

## Installation

You can install BioProps using pip:

```sh
pip install BioProps
```

## Usage

```python
from bioprops import properties_from_nifti

nifti_file = 'path_to_your_nifti_file.nii.gz'
properties = properties_from_nifti(nifti_file)
print(properties)
```

## Functions

### `properties_from_nifti(nifti_file)`

Calculates properties of cell nuclei and colonies from a NIfTI file.

- **Parameters**:
  - `nifti_file` (str): Path to the NIfTI file.

- **Returns**:
  - (str): JSON-formatted string containing computed properties.

## Example

For example, to calculate properties from a NIfTI file:

```python
from bioprops import properties_from_nifti

nifti_file = 'example.nii.gz'
properties = properties_from_nifti(nifti_file)
print(properties)
```

## Dependencies

- numpy
- nibabel
- scipy
- scikit-image

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
sosap 0.3.0
Python binding for Phonetisaurus
Requires Python: >=3.7

<img width=144 src="https://github.com/seanghay/sosap/assets/15277233/25c2ae30-4dd6-4350-a387-c30353cb2a98">

Python binding for [Phonetisaurus](https://github.com/AdolfVonKleist/Phonetisaurus) using Cython.

### Install

```shell
# pypi
pip install sosap

# GitHub
pip install git+https://github.com/seanghay/sosap.git
```

### Phoneticize


```python
from sosap import Model

model = Model("g2p.fst")
model.phoneticize("hello")
```

### Enable Sampling

```python
from sosap import Model

model = Model("g2p.fst")
results = model.phoneticize_sampling("hello", nbest=4)
# => [['h', 'ɛɛ', 'l', 'oo'], ['h', 'ee', '.', 'l', 'oo'], ['h', 'ɛɛ', 'l', '.', 'l', 'ɔɔ'], ['h', 'ɛɛ', '.', 'l', 'oo']]

results = model.phoneticize_sampling("hello", nbest=4, beam=1000, threshold=99.0, pmass=99.0)
# => [['h', 'ɛɛ', 'l', 'oo'], ['h', 'ee', '.', 'l', 'oo'], ['h', 'ɛɛ', 'l', '.', 'l', 'ɔɔ'], ['h', 'ɛɛ', '.', 'l', 'oo']]
```

---

### License

`MIT`
django-fixtures-extractor 0.1.3
Set of tools to extract fixtures from Django models navigating through the relationships of a given model to get a usable subset of the database.

=============================
Django Fixtures Extractor
=============================

.. image:: https://badge.fury.io/py/django-fixtures-extractor.svg
    :target: https://badge.fury.io/py/django-fixtures-extractor

.. image:: https://travis-ci.org/matibarriento/django-fixtures-extractor.svg?branch=master
    :target: https://travis-ci.org/matibarriento/django-fixtures-extractor

.. image:: https://codecov.io/gh/matibarriento/django-fixtures-extractor/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/matibarriento/django-fixtures-extractor

Extract specific data to a django fixture

Documentation
-------------

The full documentation is at https://django-fixtures-extractor.readthedocs.io.

Quickstart
----------

Install Django Fixtures Extractor::

    pip install django-fixtures-extractor

Add it to your `INSTALLED_APPS`:

.. code-block:: python

    INSTALLED_APPS = (
        ...
        'fixtures_extractor',
        ...
    )

TODO Features
-------------
* Add feature: Support config params
* Add feature: Obfuscate value

Desired features
----------------
* Add supported model fields
    * Many to Many with `through <https://docs.djangoproject.com/en/4.2/ref/models/fields/#django.db.models.ManyToManyField.through>`_ model
* Add feature: Generate schema from model

Running Tests
-------------

Does the code actually work?

::

    source <YOURVIRTUALENV>/bin/activate
    (myenv) $ python runtests.py


Development commands
---------------------

::

    pip install -r requirements/requirements_dev.txt


How to add a new app and add tests
----------------------------------

1. Create the app

::

    $ cd tests/testproject
    $ python ../../manage.py startapp {APP_NAME}

2. Change the :code:`{APP_NAME}Config.name` inside the :code:`tests/{APP_NAME}/apps.py` file for :code:`tests.testproject.{APP_NAME}.apps.{APP_NAME}`
3. Add the app to the :code:`INSTALLED_APPS` in the :code:`/testproject/testproject/settings.py` file
4. Write the models that you would use to test on the model folder inside your app
5. Create the migrations using :code:`python manage.py makemigrations {APP_NAME}`
6. Run the migrations using :code:`python manage.py migrate`
7. Create the tests inside the :code:`tests/tests_orm_extractor.py` file

Credits
-------

Based on https://github.com/ascaliaio/django-dumpdata-one

Tools used in rendering this package:

*  Cookiecutter_
*  `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage
global-names-David.Spencer 0.0.1
Human Names for Synthetic Data Generation
Requires Python: >=3.8

NamesData
=============

## Overview

This repository contains a collection of name datasets gathered from multiple sources, including government records, historical documents, and public databases. The data has been cleaned, standardized, and organized to facilitate easy use in data science projects, demographic studies, and name-related research.

## Features

- **Extensive Name Collection**: A wide range of first and last names from multiple countries and cultures.
- **Python Tools**: Utilities and scripts to efficiently work with the name datasets.
- **Easy Integration**: Simple and intuitive integration with your Python projects.
- **Open Source**: Released under the MIT License, allowing for free use and distribution.

## Installation

To use NameDatabases in your project, you can clone the repository and install the necessary dependencies.

```bash
git clone https://github.com/DecisionNerd/NameDatabases.git
cd NameDatabases
pip install -r requirements.txt
```

## Usage

### Loading the Datasets

You can easily load the name datasets using the provided Python tools. Below is an example of how to load and use the data.

```python
import pandas as pd

# Load last names from a specific country
last_names_df = pd.read_csv('data/last_names/usa.csv')

# Display the first few entries
print(last_names_df.head())
```

### Searching for a Name

The tools provided also include functionality to search for specific names within the datasets.

```python
from tools import name_search

# Search for a specific last name
results = name_search.search_last_name('Smith', 'usa')
print(results)
```

### Generating Random Names

You can also generate random names using the datasets for purposes such as testing or anonymizing data.

```python
from tools import name_generator

# Generate a random full name
random_name = name_generator.generate_random_name('usa')
print(random_name)
```

## Contributing

We welcome contributions from the community! If you would like to contribute, please follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or bugfix.
3. Make your changes.
4. Submit a pull request with a detailed description of your changes.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Acknowledgements

A big thank you to Matthew Hager [smashew](https://github.com/smashew) for his original work on the text databases of last names. This project builds upon the foundation he created.

A thank you to Philippe Rémy [philipperemy](https://github.com/philipperemy) for posting the username dataset.  While Philippe's work is not integrated into this project, his data preparation has greatly accelerated our work on NamesData.

## Contact

For any questions or suggestions, feel free to open an issue or start a discussion thread or contact us at hello@frontieranalytica.com.