Download generation_example.py from enver/rootformer-v12-scholastic: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/enver/rootformer-v12-scholastic/resolve/main/generation_example.py
- Command line
-
hf download hf://enver/rootformer-v12-scholastic/generation_example.py
-
curl -L -o generation_example.py https://huggingface.co/enver/rootformer-v12-scholastic/resolve/main/generation_example.py
607 Bytes
| #!/usr/bin/env python3 | |
| import torch | |
| from modeling_rootformer import UnifiedRootformerV12 | |
| from morphemic_tokenizer import PureArabicMorphemicTokenizerV12 | |
| def main(): | |
| print("Loading Rootformer v12 from local HuggingFace repo...") | |
| tok = PureArabicMorphemicTokenizerV12('rootformer_v12_arabic_blueprint.json') | |
| model = UnifiedRootformerV12( | |
| blueprint_path='rootformer_v12_arabic_blueprint.json', | |
| device='cuda' if torch.cuda.is_available() else 'cpu' | |
| ) | |
| print("Rootformer v12 successfully instantiated with Farāhīdian radical layers!") | |
| if __name__ == '__main__': | |
| main() | |