CoolFace
Apppublic

Slamlab/morphological-transformer

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

Morphological Transformer Training

Train and test morphological reinflection models using TagTransformer architecture on Hugging Face Spaces.

๐Ÿš€ Features

  • โ€”Training Interface: Train models on different datasets (10L90NL, 50L50NL, 90L_10NL)
  • โ€”Model Management: View and manage trained models
  • โ€”Testing Interface: Test trained models with custom inputs
  • โ€”Monitoring: Integration with Weights & Biases for experiment tracking
  • โ€”Cloud Optimized: Designed for Hugging Face Spaces infrastructure

๐Ÿ“Š Datasets

  • โ€”10L_90NL: 10% labeled, 90% non-labeled data
  • โ€”50L_50NL: 50% labeled, 50% non-labeled data
  • โ€”90L_10NL: 90% labeled, 10% non-labeled data

๐Ÿ”ง Setup

Environment Variables

Set these environment variables in your Space settings:

  • โ€”HF_TOKEN: Your Hugging Face token for model upload
  • โ€”WANDB_TOKEN: Your Weights & Biases token (optional)
  • โ€”WANDB_PROJECT: Project name for experiment tracking

Data Mounting

Mount your data directory to /data with the following structure:

/data/
โ”œโ”€โ”€ 10L_90NL/
โ”‚   โ”œโ”€โ”€ train/run1/
โ”‚   โ”œโ”€โ”€ dev/run1/
โ”‚   โ””โ”€โ”€ test/run1/
โ”œโ”€โ”€ 50L_50NL/
โ”‚   โ”œโ”€โ”€ train/run1/
โ”‚   โ”œโ”€โ”€ dev/run1/
โ”‚   โ””โ”€โ”€ test/run1/
โ””โ”€โ”€ 90L_10NL/
    โ”œโ”€โ”€ train/run1/
    โ”œโ”€โ”€ dev/run1/
    โ””โ”€โ”€ test/run1/

๐ŸŽฏ Usage

  1. 1.Training: Go to the Training tab, configure parameters, and start training
  2. 2.Monitoring: Watch training progress in the logs and Weights & Biases
  3. 3.Testing: Use the Testing tab to test your trained models
  4. 4.Model Management: View available models in the Models tab

๐Ÿ“ˆ Training Configuration

The training uses optimized settings for cloud infrastructure:

  • โ€”Batch Size: 32 (GPU) / 16 (CPU)
  • โ€”Learning Rate: 0.001
  • โ€”Max Epochs: 100
  • โ€”Gradient Accumulation: 4 steps
  • โ€”Mixed Precision: Enabled on GPU

๐Ÿ” Model Architecture

The TagTransformer uses:

  • โ€”Encoder-Decoder Architecture: Transformer-based sequence-to-sequence model
  • โ€”Feature Embeddings: Special embeddings for morphological features
  • โ€”Positional Encoding: Custom positional encoding for character sequences
  • โ€”Label Smoothing: Improved training stability

๐Ÿ“ Citation

If you use this code, please cite:

bibtex
@misc{morphological-transformer,
  title={Morphological Transformer for Reinflection},
  author={Your Name},
  year={2024},
  publisher={Hugging Face},
  howpublished={\url{https://huggingface.co/spaces/your-username/morphological-transformer}}
}

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License.