semvec/pypi-packages huggingface dataset:
cyantic 0.3.0
Use Pydantic to build complex types from simple parameters.
Requires Python: >=3.9

<p align="center">
  <img src="https://github.com/user-attachments/assets/4ce903ef-ae04-4c9f-9a17-ad6932472de7">
</p>

> The [cyanotype](https://en.wikipedia.org/wiki/Cyanotype) process, which gave birth to the "blueprint", uses iron salts and UV light to transform simple negatives into deep Prussian blue artwork.

## Features

Cyantic lets you build complex types from simple blueprints, using Pydantic.

* Build complex objects using intermediate Pydantic models.
* Reference other values using `@value:x.y.z`
* Import objects using `@import:x.y.z`
* Define custom `@hook` handlers (see tests)

## Installation

* `uv add cyantic`

## Usage

```python
from cyantic import Blueprint, blueprint, CyanticModel, hook
from torch import Tensor
import torch
import yaml

# 1. Create and register some useful parameterisations
#       (or soon install from PyPi, i.e. `rye add cyantic-torch`)

@blueprint(Tensor)
class NormalTensor(Blueprint[Tensor]):

    mean: float
    std: float
    size: tuple[int, ...]

    def build(self) -> Tensor:
        return torch.normal(self.mean, self.std, size=self.size)

@blueprint(Tensor)
class UniformTensor(Blueprint[Tensor]):
    low: float
    high: float
    size: tuple[int, ...]

    def build(self) -> Tensor:
      return torch.empty(self.size).uniform_(self.low, self.high)


# 2. Write pydantic models using `CyanticModel` base class

class MyModel(CyanticModel):
    normal_tensor: Tensor
    uniform_tensor: Tensor


# 3. (optional) define custom hooks

@hook("env")
def env_hook(name: str, _: ValidationContext) -> str:
    """Handle @env:VARIABLE_NAME references."""
    try:
        return os.environ[name]
    except KeyError as e:
        raise ValueError(f"Environment variable {name} not found") from e


# 4. Validate from YAML files that specify the parameterisation

some_yaml = """common:
    size: [3, 5]
    foo: @env:MY_VARIABLE
normal_tensor:
    mean: 0.0
    std: 0.1
    size: @value:common.size
uniform_tensor:
    low: -1.0
    std: 1.0
    size: @value:common.size
"""

# 4. Receive objects built from the parameterisations.

my_model = MyModel.model_validate(yaml.safe_load(some_yaml))
assert isinstance(my_model.normal_tensor, Tensor)
assert isinstance(my_model.uniform_tensor, Tensor)
```


## Development

* `git clone https://github.com/flywhl/cyantic.git`
* `cd cyantic`
* `uv sync`
* `just test`

## Flywheel

Science needs humble software tools. [Flywheel](https://flywhl.dev/) is an open source collective building simple tools to preserve scientific momentum, inspired by devtools and devops culture.
llm-auto-eda 0.0.3
An intelligent automated exploratory data analysis tool powered by Large Language Models, providing in-depth insights and visualizations for your datasets
Requires Python: >=3.7

# LLM Auto EDA

An intelligent automated exploratory data analysis tool powered by Large Language Models, providing in-depth insights and visualizations for your datasets.

## Installation

```bash
pip install llm-auto-eda
```



## Quick Start

```python
from llm_auto_eda import AutoEDA

# Initialize with your OpenAI API key (optional)
eda = AutoEDA(api_key='your-openai-api-key')

# Load and analyze your data
analysis = eda.analyze('your_data.csv')

# Generate interactive HTML report
analysis.save_report('analysis_report.html')
```

## Example Usage with Custom Parameters

```python
# Load data with specific configuration
analysis = eda.analyze(
    data_source='your_data.csv',
    domain='finance',  # Provide domain context for better insights
    exclude_columns=['id', 'timestamp']  # Exclude specific columns
)

# Access specific components
print(analysis.data_summary)  # Get data summary
print(analysis.correlations)  # Get correlation matrix
print(analysis.insights)      # Get LLM-generated insights
```
pytrainer 1.0.0
AI made easy. Based on pytorch.
Requires Python: <=3.12,>=3.9

# Pytrainer

AI made Easy.

## Tutorials

### Train and Save a Model

```python
from pytrainer.text import TextAI

# Create an instance of TextAI
ai = TextAI()

# Define some simple training data (input-output pairs)
training_data = {
    "Hello": "Hi there!",
    "How are you?": "I'm good, thank you!",
    "What's your name?": "I am TextAI."
}

# Train the model
ai.train(training_data, epochs=10, batch_size=1, learning_rate=0.001)

# Save the trained model
ai.save('trained_model.json')
```

### Load and Prompt the Model

```python
from pytrainer.text import TextAI

# Create a new instance of TextAI and load the trained model
ai_new = TextAI()
ai_new.load('trained_model.json')

# Generate a response to a new prompt
response = ai_new.prompt("What's your name?")
print(response)
```

## Classes

### `TextAI`

#### from pytrainer.text import TextAI

#### `train(self, data, epochs=10, batch_size=1, learning_rate=0.001)`

- **Arguments**:
  - `data`: A dictionary of input-output pairs for training (required).
  - `epochs`: The number of training epochs (default is 10).
  - `batch_size`: The batch size used during training (default is 1).
  - `learning_rate`: The learning rate for the optimizer (default is 0.001).

#### `prompt(self, input_text, max_length=50, temperature=0.5)`

- **Arguments**:
  - `input_text`: The text prompt to generate a response for (required).
  - `max_length`: The maximum length of the generated response (default is 50).
  - `temperature`: Controls the randomness of the generated text (default is 0.7).
  - `nearestPunctuation`: Should a word be rounded to the same word with different punctuation, if that word is not tokenized? (defualt is False)

#### `save(self, path)`

- **Arguments**:
  - `path`: The file path to save the model data (required).

#### `load(self, path)`

- **Arguments**:
  - `path`: The file path from which to load the model data (required).

#### Known Issues:

(Fixed errors will be removed next update, and moved to change log in github.)

- Exploding gradients during training of over 30 epochs, resulting in NaN errors when prompting. **FIXED**
- When prompting, using an un-tokenized word will fail. **FIXED**
  - Note: There is a new option to map un-tokenized words to the same word with different punctation, if one was tokenized. Otherwise, it will return nothing.

#### Planned Features:

- Individual classes for Tokenizers, allowing them to be customized.
- Option for built-in tokenizers, so the trained model is backward compatible with pytorch.