A Python project for connecting to and interacting with the TildeAI/TildeOpen-30b language model via Hugging Face transformers.
TildeOpen-30b is a 30B parameter open-source foundational language model built to serve underrepresented Nordic and Eastern European languages. It supports 34 languages including English, German, French, Polish, Russian, and many others, representing over 165 million speakers.
- ๐ Multilingual: 34 European languages supported
- ๐ Open Source: CC-BY-4.0 license
- โก Optimized: Equitable tokenizer for fair language representation
- ๐ฏ Focused: Specialized for Nordic and Eastern European languages
- ๐๏ธ Enterprise Ready: Trained on LUMI supercomputer with 768 AMD MI250X GPUs
# Clone this repository
git clone <https://github.com/sarkanmagij/tilde-test>
cd tilde-test
# Install dependencies
pip3 install -r requirements.txt- โ Free GPU access
- โ No local storage required
- โ Full model capabilities
- โ Interactive chat interface
# Test immediately without any downloads
python3 tilde_api_demo.py- โ Uses Hugging Face Inference API
- โ No model downloads
- โ Works on any system
- โ Immediate testing
# Explore the model without downloading 60GB+ files
python3 tilde_minimal.py- โ Only downloads tokenizer (~2.3MB)
- โ Works on any system
- โ Demonstrates multilingual capabilities
- โ Shows system requirements for full model
# Full model with optimizations
python3 tilde_lightweight.py- โ 8-bit/4-bit quantization
- โ Automatic memory management
- โ Best performance/memory balance
# CPU-optimized version (very slow)
python3 tilde_cpu_friendly.pyโ ๏ธ Extremely slow on CPUโ ๏ธ Requires significant RAM- ๐ก Cloud GPU recommended instead
# Original full model loading
python3 tilde_model.py# Test connection with full model download
python3 test_connection.pytilde-test/
โโโ README.md # This file
โโโ requirements.txt # Python dependencies
โโโ tilde_minimal.py # ๐ Minimal demo (tokenizer only, ~2MB download)
โโโ tilde_lightweight.py # ๐ฎ GPU optimized with quantization
โโโ tilde_cpu_friendly.py # ๐ป CPU optimized (slow, high RAM)
โโโ tilde_model.py # ๐ง Standard model interface
โโโ test_connection.py # ๐งช Full model connection test
โโโ tilde_api_demo.py # ๐ก API-based demo (zero downloads!)
โโโ TildeOpen_30b_Colab.ipynb # ๐ Google Colab notebook
โโโ tilde_colab_optimized.py # ๐ Colab-optimized script
โโโ app.py # ๐ Gradio web interface (HF Spaces)
โโโ requirements_spaces.txt # ๐ฆ Dependencies for HF Spaces
โโโ TildeOpen-30b-README.md # Official model documentation
- torch (โฅ2.0.0) - PyTorch framework
- transformers (โฅ4.35.0) - Hugging Face transformers
- accelerate (โฅ0.20.0) - Model acceleration
- safetensors (โฅ0.3.0) - Safe tensor serialization
- sentencepiece (โฅ0.1.99) - Tokenization (required for this model)
- protobuf (โฅ3.20.0) - Protocol buffers
Perfect for exploring TildeOpen-30b without massive downloads:
python3 tilde_minimal.pyWhat it does:
- Downloads only the tokenizer (~2.3MB)
- Demonstrates multilingual tokenization
- Shows system requirements
- Interactive tokenizer testing
- Zero model weight downloads
Best for:
- First-time exploration
- Understanding model capabilities
- Testing tokenization across 34 languages
- Checking system compatibility
For users who want the full model with minimal memory usage:
python3 tilde_lightweight.pyFeatures:
- Automatic quantization (4-bit/8-bit)
- Streams model weights as needed
- Adaptive memory management
- GPU/CPU detection
- Reduced storage requirements
from tilde_model import TildeOpenModel
# Initialize and load model
model = TildeOpenModel()
model.load_model()
# Generate text
response = model.generate_text("Hello, how are you today?", max_new_tokens=100)
print(response)The tilde_model.py script provides an interactive chat interface:
python3 tilde_model.pyFeatures:
- ๐ฌ Interactive conversation
- ๐งน Clear conversation history with
clear - ๐ช Exit with
quit,exit, orq - ๐๏ธ Configurable generation parameters
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load tokenizer (use_fast=False is required!)
tokenizer = AutoTokenizer.from_pretrained("TildeAI/TildeOpen-30b", use_fast=False)
# Load model
model = AutoModelForCausalLM.from_pretrained(
"TildeAI/TildeOpen-30b",
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Generate
inputs = tokenizer("Your prompt here", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=512)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)- RAM: 32GB+ recommended (for 30B parameter model)
- GPU: 24GB+ VRAM recommended (RTX 3090, RTX 4090, A100, etc.)
- Storage: 65GB+ free space for model files
- Python: 3.8+
- ๐ฅ๏ธ CPU Only: Will work but be extremely slow
- ๐ฎ GPU Recommended: Significant performance improvement
- โ๏ธ Cloud Options: Google Colab, Hugging Face Spaces, AWS, or similar for GPU access
Perfect for your M2 Mac with 8GB RAM!
-
Enable GPU: Go to
Runtime>Change runtime type> SelectGPU -
Run all cells in order - the notebook includes:
- Automatic dependency installation
- Model loading with quantization
- Interactive chat interface
- Multilingual testing examples
-
Alternative Colab Script:
# Upload tilde_colab_optimized.py to Colab and run: python3 tilde_colab_optimized.py
Deploy your own web interface:
- Fork this repository
- Create a new Space on Hugging Face
- Upload these files:
app.py(main Gradio interface)requirements_spaces.txt(rename torequirements.txt)README_spaces.md(rename toREADME.md)
- Set GPU hardware in Space settings
- Your web interface will be live!
For immediate testing without setup:
# Use the API demo (no local downloads)
python3 tilde_api_demo.pyThis uses Hugging Face's Inference API - zero setup required!
Bulgarian, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, German, Hungarian, Icelandic, Irish, Italian, Latvian, Lithuanian, Macedonian, Maltese, Norwegian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, Turkish, Ukrainian, and more.
TildeOpen-30b shows excellent performance on underrepresented European languages compared to other large language models. See TildeOpen-30b-README.md for detailed benchmarks.
- SentencePiece Error: Install with
pip install sentencepiece - CUDA Out of Memory: Reduce batch size or use CPU
- Slow Generation: Ensure GPU is being used properly
- Model Download Fails: Check internet connection and disk space
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU name: {torch.cuda.get_device_name() if torch.cuda.is_available() else 'None'}")Feel free to submit issues and enhancement requests!
This project is open source. The TildeOpen-30b model is licensed under CC-BY-4.0.
- ๐ค Model on Hugging Face
- ๐ข Tilde.ai
- ๐ TILDE Bench
- ๐ช๐บ EuroHPC JU Large AI Grand Challenge
Note: This is a foundational model not yet adapted for instruction following or safety alignment. The next version will be a specialized translation model.