A ai library combining the best of TensorFlow and PyTorch
Project description
Texor - Comprehensive AI Framework
Texor is a comprehensive AI framework that combines the best features of TensorFlow and PyTorch. It provides a high-level API while maintaining flexibility and performance through a hybrid backend system.
Key Features
1. Hybrid Backend
- Leverage the power of both TensorFlow and PyTorch
- Seamlessly switch between backends
- Automatic optimization based on use case
2. Core API
from texor.core import Tensor
# Create tensors from various sources
x = Tensor([[1, 2], [3, 4]]) # From Python list
x = Tensor(numpy_array) # From NumPy array
x = Tensor(tf_tensor) # From TensorFlow tensor
x = Tensor(torch_tensor) # From PyTorch tensor
# Access data in multiple formats
numpy_data = x.numpy()
tf_data = x.tensorflow()
torch_data = x.pytorch()
3. Neural Network Layers
from texor.nn import Sequential, Linear, Conv2D, MaxPool2D, ReLU, Dropout
model = Sequential([
Conv2D(in_channels=1, out_channels=32, kernel_size=3),
ReLU(),
MaxPool2D(kernel_size=2),
Conv2D(in_channels=32, out_channels=64, kernel_size=3),
ReLU(),
MaxPool2D(kernel_size=2),
Linear(in_features=1600, out_features=10)
])
4. Optimizers
from texor.optim import SGD, Adam, RMSprop
# Create optimizer
optimizer = Adam(model.parameters(), lr=0.001)
optimizer = SGD(model.parameters(), lr=0.01, momentum=0.9)
5. Loss Functions
from texor.nn import MSELoss, CrossEntropyLoss, BCELoss
# Use loss functions
criterion = CrossEntropyLoss()
loss = criterion(predictions, targets)
Installation
pip install texor
Command Line Interface (CLI)
Texor provides a powerful CLI with intuitive features:
# View environment and setup information
texor info
# List available modules
texor list
# Search for specific modules
texor list resnet
# Check environment and dependencies
texor check
CLI Features:
- Color Output: Messages, warnings, and errors with clear color coding
- Progress Bars: Visual progress for long-running tasks
- Interactive Interface: User-friendly command line operations
- System Information: Detailed environment and configuration details
Basic Example
from texor.nn import Sequential, Linear, ReLU
from texor.core import Tensor
import numpy as np
# Create model
model = Sequential([
Linear(input_size=784, output_size=256),
ReLU(),
Linear(input_size=256, output_size=10)
])
# Compile model
model.compile(
optimizer='adam',
loss='categorical_crossentropy'
)
# Create sample data
x = np.random.randn(100, 784)
y = np.random.randint(0, 10, size=(100,))
y = np.eye(10)[y] # One-hot encode
# Train model
model.fit(
x=Tensor(x),
y=Tensor(y),
epochs=10,
batch_size=32
)
MNIST Example
See examples/mnist_example.py for a complete example of training a CNN on the MNIST dataset.
API Documentation
Core Module
Tensor: Basic class for tensor operationszeros,ones,randn: Tensor creation functionsfrom_numpy,from_tensorflow,from_pytorch: Conversions from other formats
Neural Network (nn) Module
- Layers:
Linear,Conv2D,MaxPool2D,Dropout - Activations:
ReLU,Sigmoid,Tanh - Loss Functions:
MSELoss,CrossEntropyLoss,BCELoss - Model:
Sequential- Easy-to-use API for model building
Optimizers Module
SGD: Stochastic Gradient Descent with momentumAdam: Adam optimizerRMSprop: RMSprop optimizer
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for more details.
License
MIT License - see the LICENSE file for details.
Language Support
For Vietnamese documentation, please see README_VN.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file texor-0.1.0.tar.gz.
File metadata
- Download URL: texor-0.1.0.tar.gz
- Upload date:
- Size: 48.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6bad8e0ffa1e074be76e33e3a43ca463117869b521f4169c90db4918b73f7c5
|
|
| MD5 |
0bad61c5b9a4b8deaa2def5ff41b337e
|
|
| BLAKE2b-256 |
eaae1331f3200371cee139881404df3a7aa14ca3319d6d5725ba3d5e475afbe1
|
File details
Details for the file texor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: texor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b6bffd3f5e5855ff056cdba75e5f9192427a580d3af0916e6d1251ae8db73a0
|
|
| MD5 |
c3be7fe6a94d7feb3a641a70c7bcf645
|
|
| BLAKE2b-256 |
7a2712735d1598919b6060eb71d2f034ff70832a794de007ef8a076a7e7388c9
|