polymesh-ai


Namepolymesh-ai JSON
Version 0.3.4 PyPI version JSON
download
home_pageNone
SummaryTransformer Library for 3D Mesh Processing
upload_time2025-08-16 03:13:16
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords 3d mesh transformer deep-learning pytorch computer-vision
VCS
bugtrack_url
requirements torch numpy tqdm wandb matplotlib scipy scikit-learn pytest black flake8 jupyter sphinx sphinx-rtd-theme
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # polymesh-ai Library Usage Guide

Complete guide for using polymesh-ai - the transformer library for 3D mesh processing.

## 📦 Installation

### Install from PyPI (Recommended)
```bash
# Basic installation
pip install polymesh-ai

# Full installation with all features
pip install polymesh-ai[full]

# Development installation
pip install polymesh-ai[dev]
```

### Install from Source
```bash
git clone https://github.com/MatN23/polymesh-ai.git
cd polymesh-ai
pip install -e .
```

### Installation Options
- **Basic**: `pip install polymesh-ai` - Core functionality only
- **Full**: `pip install polymesh-ai[full]` - Includes wandb, matplotlib, scipy, scikit-learn
- **Dev**: `pip install polymesh-ai[dev]` - Development tools (pytest, black, flake8, jupyter)
- **Docs**: `pip install polymesh-ai[docs]` - Documentation tools (sphinx, themes)

## 🚀 Quick Start

### 1. Basic Mesh Classification

```python
import torch
import polymesh-ai
from polymesh-ai import VertexTokenizer, MeshTransformer
import numpy as np

# Create sample mesh data (you'll need actual mesh data)
# This is just for demonstration - replace with your mesh loading code
class SimpleMesh:
    def __init__(self):
        # Create a simple triangle mesh
        self.vertices = [
            SimpleVertex([0.0, 0.0, 0.0], [0, 0, 1]),
            SimpleVertex([1.0, 0.0, 0.0], [0, 0, 1]), 
            SimpleVertex([0.5, 1.0, 0.0], [0, 0, 1])
        ]

class SimpleVertex:
    def __init__(self, position, normal=None):
        self.position = np.array(position, dtype=np.float32)
        self.normal = np.array(normal, dtype=np.float32) if normal else None

# Load or create your mesh
mesh = SimpleMesh()

# Initialize tokenizer
tokenizer = VertexTokenizer(
    include_normals=True,
    include_colors=False
)

# Create model
model = MeshTransformer(
    feature_dim=6,      # 3 position + 3 normal
    d_model=256,
    nhead=8,
    num_layers=6
)

# Tokenize and process
tokens = tokenizer.tokenize(mesh)
print(f"Generated {len(tokens)} tokens")

# Run classification
with torch.no_grad():
    output = model(tokens, task='classification')
    print(f"Classification output shape: {output.shape}")
```

### 2. Advanced Model with Adaptive Attention

```python
from polymesh-ai import AdaptiveMeshTransformer

# Create adaptive model that switches attention mechanisms
model = AdaptiveMeshTransformer(
    d_model=512,
    nhead=8,
    num_layers=6,
    dim_feedforward=2048,
    dropout=0.1
)

# Prepare tensor inputs for adaptive model
batch_size, seq_len = 1, len(tokens)
features = torch.tensor([token.features for token in tokens]).unsqueeze(0)
positions = torch.tensor([token.position for token in tokens]).unsqueeze(0)

# Forward pass
output = model(features, positions)
print(f"Adaptive model output shape: {output.shape}")
```

## 🎯 Core Components

### Tokenization Strategies

#### Vertex Tokenizer
```python
from polymesh-ai import VertexTokenizer

# Basic vertex tokenization
tokenizer = VertexTokenizer(
    include_normals=True,
    include_colors=True,
    quantize_positions=False
)

tokens = tokenizer.tokenize(mesh)
```

#### Face Tokenizer  
```python
from polymesh-ai import FaceTokenizer

# Face-based tokenization
face_tokenizer = FaceTokenizer(
    max_face_vertices=4,
    include_face_normal=True
)

face_tokens = face_tokenizer.tokenize(mesh)
```

#### Patch Tokenizer
```python
from polymesh-ai import PatchTokenizer

# Patch-based hierarchical tokenization
patch_tokenizer = PatchTokenizer(
    patch_size=16,
    overlap=4,
    feature_aggregation='mean'
)

patch_tokens = patch_tokenizer.tokenize(mesh)
```

### Attention Mechanisms

#### Geometric Attention
```python
from polymesh-ai import GeometricAttention

# Distance-aware attention
geo_attention = GeometricAttention(
    d_model=256,
    nhead=8,
    max_distance=5.0,
    distance_bins=32
)
```

#### Graph Attention
```python
from polymesh-ai import GraphAttention

# Graph-based attention for mesh connectivity
graph_attention = GraphAttention(
    d_model=256,
    nhead=8,
    edge_dim=16
)
```

#### Multi-Scale Attention
```python
from polymesh-ai import MultiScaleAttention

# Hierarchical multi-scale processing
multiscale_attention = MultiScaleAttention(
    d_model=256,
    scales=[1, 2, 4, 8],
    nhead=8
)
```

#### Sparse Attention
```python
from polymesh-ai import SparseAttention

# Efficient attention for large meshes
sparse_attention = SparseAttention(
    d_model=256,
    nhead=8,
    neighborhood_size=16,
    sparse_pattern='spatial'
)
```

## 🏋️ Training Pipeline

### Complete Training Setup

```python
from polymesh-ai import (
    MeshTransformerTrainingPipeline,
    MeshTransformerDataset,
    MeshAugmentation
)

# Training configuration
config = {
    'model_type': 'adaptive',
    'tokenizer_type': 'vertex',
    'd_model': 256,
    'nhead': 8,
    'num_layers': 6,
    'learning_rate': 1e-4,
    'batch_size': 16,
    'max_epochs': 100,
    'early_stopping_patience': 15,
    'device': 'cuda' if torch.cuda.is_available() else 'cpu',
    'use_wandb': False,  # Set True for experiment tracking
    'task_type': 'classification'
}

# Initialize training pipeline
pipeline = MeshTransformerTrainingPipeline(config)

# Prepare your dataset
train_data = [
    {'mesh': mesh1, 'label': 0, 'id': 'mesh_001'},
    {'mesh': mesh2, 'label': 1, 'id': 'mesh_002'},
    # ... more training data
]

val_data = [
    {'mesh': val_mesh1, 'label': 0, 'id': 'val_001'},
    # ... validation data
]

# Create datasets with augmentation
train_dataset = MeshTransformerDataset(
    train_data,
    pipeline.tokenizer,
    task_type='classification',
    augmentation_fn=MeshAugmentation.random_augment,
    max_seq_len=512
)

val_dataset = MeshTransformerDataset(
    val_data,
    pipeline.tokenizer,
    task_type='classification',
    max_seq_len=512
)

# Train the model
pipeline.train(train_dataset, val_dataset)
```

### Data Augmentation

```python
from polymesh-ai import MeshAugmentation

# Individual augmentations
rotated_mesh = MeshAugmentation.random_rotation(mesh, angle_range=30.0)
scaled_mesh = MeshAugmentation.random_scale(mesh, scale_range=(0.8, 1.2))
translated_mesh = MeshAugmentation.random_translation(mesh, translation_range=0.1)
noisy_mesh = MeshAugmentation.add_noise(mesh, noise_std=0.01)

# Combined random augmentation
augmented_mesh = MeshAugmentation.random_augment(mesh)
```

## 🎨 Use Cases & Applications

### 3D Shape Classification

```python
# Configure for classification
config = {
    'model_type': 'standard',
    'task_type': 'classification',
    'feature_dim': 6,  # Position + Normal
    'd_model': 512,
    'num_layers': 8
}

pipeline = MeshTransformerTrainingPipeline(config)

# Your mesh dataset with labels
mesh_classes = ['chair', 'table', 'lamp', 'sofa']
# Train classifier...
```

### Mesh Reconstruction/Autoencoder

```python
# Configure for reconstruction
config = {
    'model_type': 'standard',
    'task_type': 'reconstruction',
    'feature_dim': 6,
    'd_model': 512,
    'learning_rate': 1e-5,
    'max_epochs': 200
}

pipeline = MeshTransformerTrainingPipeline(config)

# Train autoencoder for mesh compression/denoising
model = pipeline.model
with torch.no_grad():
    reconstructed = model(tokens, task='reconstruction')
```

### Mesh Generation

```python
# Configure for generation
config = {
    'model_type': 'adaptive',
    'task_type': 'generation',
    'd_model': 768,
    'num_layers': 12
}

# Pre-training tasks
from polymesh-ai import MeshTransformerPreTrainer

trainer = MeshTransformerPreTrainer(model, tokenizer)

# Masked mesh modeling
masked_input, positions, targets = trainer.masked_mesh_modeling(tokens, mask_ratio=0.15)

# Mesh completion
partial_input, complete_target = trainer.mesh_completion_task(partial_tokens, complete_tokens)
```

## 🔧 Advanced Features

### Custom Attention Mechanisms

```python
from polymesh-ai import MeshTransformerLayer

# Create custom transformer layers
custom_layer = MeshTransformerLayer(
    d_model=256,
    nhead=8,
    attention_type='geometric'  # or 'graph', 'multiscale', 'sparse'
)
```

### 3D Positional Encoding

```python
from polymesh-ai import MeshPositionalEncoding

# Custom 3D positional encoding
pos_encoding = MeshPositionalEncoding(
    d_model=256,
    max_freq=10.0,
    num_freq_bands=10
)

# Apply to 3D positions
positions = torch.randn(batch_size, seq_len, 3)
pos_embeddings = pos_encoding(positions)
```

### Model Checkpointing

```python
# Save model checkpoint
pipeline.save_checkpoint('my_model_epoch_50.pth')

# Load checkpoint
pipeline.load_checkpoint('my_model_epoch_50.pth')

# Save just the model state
torch.save(pipeline.model.state_dict(), 'model_weights.pth')
```

## 📊 Monitoring & Logging

### WandB Integration

```python
# Enable WandB logging
config = {
    'use_wandb': True,
    'wandb_project': 'mesh-transformer-experiments',
    # ... other config
}

# Your training will automatically log to WandB
pipeline = MeshTransformerTrainingPipeline(config)
```

### Custom Metrics

```python
# Track custom metrics during training
def compute_custom_metrics(predictions, targets):
    # Your custom metric computation
    return {'custom_accuracy': accuracy, 'custom_f1': f1_score}

# Extend the training pipeline with custom metrics
```

## 🐛 Troubleshooting

### Common Issues

1. **Memory Issues with Large Meshes**
```python
# Use sparse attention for large meshes
model = MeshTransformer(
    feature_dim=6,
    d_model=256,
    # ... other params
)

# Or chunk your processing
def process_large_mesh(mesh, chunk_size=1000):
    tokens = tokenizer.tokenize(mesh)
    results = []
    for i in range(0, len(tokens), chunk_size):
        chunk = tokens[i:i+chunk_size]
        result = model(chunk)
        results.append(result)
    return torch.cat(results, dim=0)
```

2. **GPU Memory Management**
```python
# Clear cache between batches
torch.cuda.empty_cache()

# Use mixed precision training
config['use_amp'] = True  # If implemented
```

3. **Custom Mesh Loading**
```python
# Implement your own mesh class compatible with tokenizers
class CustomMesh:
    def __init__(self, vertices, faces=None):
        self.vertices = [CustomVertex(v) for v in vertices]
        self.faces = faces
        
class CustomVertex:
    def __init__(self, position, normal=None, color=None):
        self.position = np.array(position, dtype=np.float32)
        self.normal = np.array(normal, dtype=np.float32) if normal else None
        self.color = np.array(color, dtype=np.float32) if color else None
```

## 📚 Examples & Tutorials

Check the library's `examples/` directory for:
- Basic classification tutorial
- Mesh autoencoder training
- Custom tokenizer implementation
- Advanced attention mechanism usage
- Large-scale training pipelines

## 🤝 Contributing

The library is actively developed! Contribute by:
1. Reporting issues on GitHub
2. Submitting pull requests
3. Adding new attention mechanisms
4. Improving documentation
5. Creating examples and tutorials

---

**Happy mesh processing with polymesh-ai! 🎉**

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "polymesh-ai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "3d, mesh, transformer, deep-learning, pytorch, computer-vision",
    "author": null,
    "author_email": "Matias Nielsen <matiasnhmb@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bf/b3/2183d7056089246677d79a361645f1771b490e8a63483d5fd8b308279c34/polymesh_ai-0.3.4.tar.gz",
    "platform": null,
    "description": "# polymesh-ai Library Usage Guide\n\nComplete guide for using polymesh-ai - the transformer library for 3D mesh processing.\n\n## \ud83d\udce6 Installation\n\n### Install from PyPI (Recommended)\n```bash\n# Basic installation\npip install polymesh-ai\n\n# Full installation with all features\npip install polymesh-ai[full]\n\n# Development installation\npip install polymesh-ai[dev]\n```\n\n### Install from Source\n```bash\ngit clone https://github.com/MatN23/polymesh-ai.git\ncd polymesh-ai\npip install -e .\n```\n\n### Installation Options\n- **Basic**: `pip install polymesh-ai` - Core functionality only\n- **Full**: `pip install polymesh-ai[full]` - Includes wandb, matplotlib, scipy, scikit-learn\n- **Dev**: `pip install polymesh-ai[dev]` - Development tools (pytest, black, flake8, jupyter)\n- **Docs**: `pip install polymesh-ai[docs]` - Documentation tools (sphinx, themes)\n\n## \ud83d\ude80 Quick Start\n\n### 1. Basic Mesh Classification\n\n```python\nimport torch\nimport polymesh-ai\nfrom polymesh-ai import VertexTokenizer, MeshTransformer\nimport numpy as np\n\n# Create sample mesh data (you'll need actual mesh data)\n# This is just for demonstration - replace with your mesh loading code\nclass SimpleMesh:\n    def __init__(self):\n        # Create a simple triangle mesh\n        self.vertices = [\n            SimpleVertex([0.0, 0.0, 0.0], [0, 0, 1]),\n            SimpleVertex([1.0, 0.0, 0.0], [0, 0, 1]), \n            SimpleVertex([0.5, 1.0, 0.0], [0, 0, 1])\n        ]\n\nclass SimpleVertex:\n    def __init__(self, position, normal=None):\n        self.position = np.array(position, dtype=np.float32)\n        self.normal = np.array(normal, dtype=np.float32) if normal else None\n\n# Load or create your mesh\nmesh = SimpleMesh()\n\n# Initialize tokenizer\ntokenizer = VertexTokenizer(\n    include_normals=True,\n    include_colors=False\n)\n\n# Create model\nmodel = MeshTransformer(\n    feature_dim=6,      # 3 position + 3 normal\n    d_model=256,\n    nhead=8,\n    num_layers=6\n)\n\n# Tokenize and process\ntokens = tokenizer.tokenize(mesh)\nprint(f\"Generated {len(tokens)} tokens\")\n\n# Run classification\nwith torch.no_grad():\n    output = model(tokens, task='classification')\n    print(f\"Classification output shape: {output.shape}\")\n```\n\n### 2. Advanced Model with Adaptive Attention\n\n```python\nfrom polymesh-ai import AdaptiveMeshTransformer\n\n# Create adaptive model that switches attention mechanisms\nmodel = AdaptiveMeshTransformer(\n    d_model=512,\n    nhead=8,\n    num_layers=6,\n    dim_feedforward=2048,\n    dropout=0.1\n)\n\n# Prepare tensor inputs for adaptive model\nbatch_size, seq_len = 1, len(tokens)\nfeatures = torch.tensor([token.features for token in tokens]).unsqueeze(0)\npositions = torch.tensor([token.position for token in tokens]).unsqueeze(0)\n\n# Forward pass\noutput = model(features, positions)\nprint(f\"Adaptive model output shape: {output.shape}\")\n```\n\n## \ud83c\udfaf Core Components\n\n### Tokenization Strategies\n\n#### Vertex Tokenizer\n```python\nfrom polymesh-ai import VertexTokenizer\n\n# Basic vertex tokenization\ntokenizer = VertexTokenizer(\n    include_normals=True,\n    include_colors=True,\n    quantize_positions=False\n)\n\ntokens = tokenizer.tokenize(mesh)\n```\n\n#### Face Tokenizer  \n```python\nfrom polymesh-ai import FaceTokenizer\n\n# Face-based tokenization\nface_tokenizer = FaceTokenizer(\n    max_face_vertices=4,\n    include_face_normal=True\n)\n\nface_tokens = face_tokenizer.tokenize(mesh)\n```\n\n#### Patch Tokenizer\n```python\nfrom polymesh-ai import PatchTokenizer\n\n# Patch-based hierarchical tokenization\npatch_tokenizer = PatchTokenizer(\n    patch_size=16,\n    overlap=4,\n    feature_aggregation='mean'\n)\n\npatch_tokens = patch_tokenizer.tokenize(mesh)\n```\n\n### Attention Mechanisms\n\n#### Geometric Attention\n```python\nfrom polymesh-ai import GeometricAttention\n\n# Distance-aware attention\ngeo_attention = GeometricAttention(\n    d_model=256,\n    nhead=8,\n    max_distance=5.0,\n    distance_bins=32\n)\n```\n\n#### Graph Attention\n```python\nfrom polymesh-ai import GraphAttention\n\n# Graph-based attention for mesh connectivity\ngraph_attention = GraphAttention(\n    d_model=256,\n    nhead=8,\n    edge_dim=16\n)\n```\n\n#### Multi-Scale Attention\n```python\nfrom polymesh-ai import MultiScaleAttention\n\n# Hierarchical multi-scale processing\nmultiscale_attention = MultiScaleAttention(\n    d_model=256,\n    scales=[1, 2, 4, 8],\n    nhead=8\n)\n```\n\n#### Sparse Attention\n```python\nfrom polymesh-ai import SparseAttention\n\n# Efficient attention for large meshes\nsparse_attention = SparseAttention(\n    d_model=256,\n    nhead=8,\n    neighborhood_size=16,\n    sparse_pattern='spatial'\n)\n```\n\n## \ud83c\udfcb\ufe0f Training Pipeline\n\n### Complete Training Setup\n\n```python\nfrom polymesh-ai import (\n    MeshTransformerTrainingPipeline,\n    MeshTransformerDataset,\n    MeshAugmentation\n)\n\n# Training configuration\nconfig = {\n    'model_type': 'adaptive',\n    'tokenizer_type': 'vertex',\n    'd_model': 256,\n    'nhead': 8,\n    'num_layers': 6,\n    'learning_rate': 1e-4,\n    'batch_size': 16,\n    'max_epochs': 100,\n    'early_stopping_patience': 15,\n    'device': 'cuda' if torch.cuda.is_available() else 'cpu',\n    'use_wandb': False,  # Set True for experiment tracking\n    'task_type': 'classification'\n}\n\n# Initialize training pipeline\npipeline = MeshTransformerTrainingPipeline(config)\n\n# Prepare your dataset\ntrain_data = [\n    {'mesh': mesh1, 'label': 0, 'id': 'mesh_001'},\n    {'mesh': mesh2, 'label': 1, 'id': 'mesh_002'},\n    # ... more training data\n]\n\nval_data = [\n    {'mesh': val_mesh1, 'label': 0, 'id': 'val_001'},\n    # ... validation data\n]\n\n# Create datasets with augmentation\ntrain_dataset = MeshTransformerDataset(\n    train_data,\n    pipeline.tokenizer,\n    task_type='classification',\n    augmentation_fn=MeshAugmentation.random_augment,\n    max_seq_len=512\n)\n\nval_dataset = MeshTransformerDataset(\n    val_data,\n    pipeline.tokenizer,\n    task_type='classification',\n    max_seq_len=512\n)\n\n# Train the model\npipeline.train(train_dataset, val_dataset)\n```\n\n### Data Augmentation\n\n```python\nfrom polymesh-ai import MeshAugmentation\n\n# Individual augmentations\nrotated_mesh = MeshAugmentation.random_rotation(mesh, angle_range=30.0)\nscaled_mesh = MeshAugmentation.random_scale(mesh, scale_range=(0.8, 1.2))\ntranslated_mesh = MeshAugmentation.random_translation(mesh, translation_range=0.1)\nnoisy_mesh = MeshAugmentation.add_noise(mesh, noise_std=0.01)\n\n# Combined random augmentation\naugmented_mesh = MeshAugmentation.random_augment(mesh)\n```\n\n## \ud83c\udfa8 Use Cases & Applications\n\n### 3D Shape Classification\n\n```python\n# Configure for classification\nconfig = {\n    'model_type': 'standard',\n    'task_type': 'classification',\n    'feature_dim': 6,  # Position + Normal\n    'd_model': 512,\n    'num_layers': 8\n}\n\npipeline = MeshTransformerTrainingPipeline(config)\n\n# Your mesh dataset with labels\nmesh_classes = ['chair', 'table', 'lamp', 'sofa']\n# Train classifier...\n```\n\n### Mesh Reconstruction/Autoencoder\n\n```python\n# Configure for reconstruction\nconfig = {\n    'model_type': 'standard',\n    'task_type': 'reconstruction',\n    'feature_dim': 6,\n    'd_model': 512,\n    'learning_rate': 1e-5,\n    'max_epochs': 200\n}\n\npipeline = MeshTransformerTrainingPipeline(config)\n\n# Train autoencoder for mesh compression/denoising\nmodel = pipeline.model\nwith torch.no_grad():\n    reconstructed = model(tokens, task='reconstruction')\n```\n\n### Mesh Generation\n\n```python\n# Configure for generation\nconfig = {\n    'model_type': 'adaptive',\n    'task_type': 'generation',\n    'd_model': 768,\n    'num_layers': 12\n}\n\n# Pre-training tasks\nfrom polymesh-ai import MeshTransformerPreTrainer\n\ntrainer = MeshTransformerPreTrainer(model, tokenizer)\n\n# Masked mesh modeling\nmasked_input, positions, targets = trainer.masked_mesh_modeling(tokens, mask_ratio=0.15)\n\n# Mesh completion\npartial_input, complete_target = trainer.mesh_completion_task(partial_tokens, complete_tokens)\n```\n\n## \ud83d\udd27 Advanced Features\n\n### Custom Attention Mechanisms\n\n```python\nfrom polymesh-ai import MeshTransformerLayer\n\n# Create custom transformer layers\ncustom_layer = MeshTransformerLayer(\n    d_model=256,\n    nhead=8,\n    attention_type='geometric'  # or 'graph', 'multiscale', 'sparse'\n)\n```\n\n### 3D Positional Encoding\n\n```python\nfrom polymesh-ai import MeshPositionalEncoding\n\n# Custom 3D positional encoding\npos_encoding = MeshPositionalEncoding(\n    d_model=256,\n    max_freq=10.0,\n    num_freq_bands=10\n)\n\n# Apply to 3D positions\npositions = torch.randn(batch_size, seq_len, 3)\npos_embeddings = pos_encoding(positions)\n```\n\n### Model Checkpointing\n\n```python\n# Save model checkpoint\npipeline.save_checkpoint('my_model_epoch_50.pth')\n\n# Load checkpoint\npipeline.load_checkpoint('my_model_epoch_50.pth')\n\n# Save just the model state\ntorch.save(pipeline.model.state_dict(), 'model_weights.pth')\n```\n\n## \ud83d\udcca Monitoring & Logging\n\n### WandB Integration\n\n```python\n# Enable WandB logging\nconfig = {\n    'use_wandb': True,\n    'wandb_project': 'mesh-transformer-experiments',\n    # ... other config\n}\n\n# Your training will automatically log to WandB\npipeline = MeshTransformerTrainingPipeline(config)\n```\n\n### Custom Metrics\n\n```python\n# Track custom metrics during training\ndef compute_custom_metrics(predictions, targets):\n    # Your custom metric computation\n    return {'custom_accuracy': accuracy, 'custom_f1': f1_score}\n\n# Extend the training pipeline with custom metrics\n```\n\n## \ud83d\udc1b Troubleshooting\n\n### Common Issues\n\n1. **Memory Issues with Large Meshes**\n```python\n# Use sparse attention for large meshes\nmodel = MeshTransformer(\n    feature_dim=6,\n    d_model=256,\n    # ... other params\n)\n\n# Or chunk your processing\ndef process_large_mesh(mesh, chunk_size=1000):\n    tokens = tokenizer.tokenize(mesh)\n    results = []\n    for i in range(0, len(tokens), chunk_size):\n        chunk = tokens[i:i+chunk_size]\n        result = model(chunk)\n        results.append(result)\n    return torch.cat(results, dim=0)\n```\n\n2. **GPU Memory Management**\n```python\n# Clear cache between batches\ntorch.cuda.empty_cache()\n\n# Use mixed precision training\nconfig['use_amp'] = True  # If implemented\n```\n\n3. **Custom Mesh Loading**\n```python\n# Implement your own mesh class compatible with tokenizers\nclass CustomMesh:\n    def __init__(self, vertices, faces=None):\n        self.vertices = [CustomVertex(v) for v in vertices]\n        self.faces = faces\n        \nclass CustomVertex:\n    def __init__(self, position, normal=None, color=None):\n        self.position = np.array(position, dtype=np.float32)\n        self.normal = np.array(normal, dtype=np.float32) if normal else None\n        self.color = np.array(color, dtype=np.float32) if color else None\n```\n\n## \ud83d\udcda Examples & Tutorials\n\nCheck the library's `examples/` directory for:\n- Basic classification tutorial\n- Mesh autoencoder training\n- Custom tokenizer implementation\n- Advanced attention mechanism usage\n- Large-scale training pipelines\n\n## \ud83e\udd1d Contributing\n\nThe library is actively developed! Contribute by:\n1. Reporting issues on GitHub\n2. Submitting pull requests\n3. Adding new attention mechanisms\n4. Improving documentation\n5. Creating examples and tutorials\n\n---\n\n**Happy mesh processing with polymesh-ai! \ud83c\udf89**\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Transformer Library for 3D Mesh Processing",
    "version": "0.3.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/MatN23/pymesh3d/issues",
        "Documentation": "https://pymesh3d.readthedocs.io/",
        "Homepage": "https://github.com/MatN23/pymesh3d",
        "Repository": "https://github.com/MatN23/pymesh3d"
    },
    "split_keywords": [
        "3d",
        " mesh",
        " transformer",
        " deep-learning",
        " pytorch",
        " computer-vision"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f6333bf693c6b8c632ada875d1c029ad66ecbae8a7911776724cbb0a08506c49",
                "md5": "1784d74d6692b0e71e1e5d0f5750edb0",
                "sha256": "2234d2ad5359a57896d8a5a58262c6972fbce06d65c5027eaaa56e6259973e28"
            },
            "downloads": -1,
            "filename": "polymesh_ai-0.3.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1784d74d6692b0e71e1e5d0f5750edb0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6013,
            "upload_time": "2025-08-16T03:13:14",
            "upload_time_iso_8601": "2025-08-16T03:13:14.860287Z",
            "url": "https://files.pythonhosted.org/packages/f6/33/3bf693c6b8c632ada875d1c029ad66ecbae8a7911776724cbb0a08506c49/polymesh_ai-0.3.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bfb32183d7056089246677d79a361645f1771b490e8a63483d5fd8b308279c34",
                "md5": "1928c2fadaea4bf20adbaaae2406939e",
                "sha256": "f71bf04185558d8ea67f14ee69d89fbabd4bb7591580844d9cccb0fae41cb501"
            },
            "downloads": -1,
            "filename": "polymesh_ai-0.3.4.tar.gz",
            "has_sig": false,
            "md5_digest": "1928c2fadaea4bf20adbaaae2406939e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6661,
            "upload_time": "2025-08-16T03:13:16",
            "upload_time_iso_8601": "2025-08-16T03:13:16.057723Z",
            "url": "https://files.pythonhosted.org/packages/bf/b3/2183d7056089246677d79a361645f1771b490e8a63483d5fd8b308279c34/polymesh_ai-0.3.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-16 03:13:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MatN23",
    "github_project": "pymesh3d",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "torch",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.21.0"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    ">=",
                    "4.64.0"
                ]
            ]
        },
        {
            "name": "wandb",
            "specs": [
                [
                    ">=",
                    "0.15.0"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    ">=",
                    "3.5.0"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "22.0.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "jupyter",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "sphinx",
            "specs": [
                [
                    ">=",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "sphinx-rtd-theme",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        }
    ],
    "lcname": "polymesh-ai"
}
        
Elapsed time: 1.05104s