Download load_from_huggingface.py from ChadlieOak/ae: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/ChadlieOak/ae/resolve/main/load_from_huggingface.py
- Command line
-
hf download hf://ChadlieOak/ae/load_from_huggingface.py
-
curl -L -o load_from_huggingface.py https://huggingface.co/ChadlieOak/ae/resolve/main/load_from_huggingface.py
1.16 kB
| #!/usr/bin/env python3 | |
| """ | |
| Load ZRIA model from Hugging Face Hub | |
| """ | |
| from transformers import AutoTokenizer, AutoModel | |
| import torch | |
| def load_zria_from_hub(): | |
| """Load the ZRIA model from Hugging Face Hub.""" | |
| # Load tokenizer and model | |
| model_name = "your-username/zria-ultimate-pfaf" # Change to your username | |
| print(f"Loading model from: {model_name}") | |
| try: | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = AutoModel.from_pretrained(model_name) | |
| print("Model loaded successfully!") | |
| # Test the model | |
| text = "artificial intelligence is amazing" | |
| inputs = tokenizer(text, return_tensors="pt") | |
| with torch.no_grad(): | |
| outputs = model(**inputs) | |
| print(f"Input: {text}") | |
| print(f"Sentiment: {outputs.sentiment}") | |
| print(f"Action Value: {outputs.action_value}") | |
| print(f"Route Probability: {outputs.route_probability}") | |
| except Exception as e: | |
| print(f"Error loading model: {e}") | |
| if __name__ == "__main__": | |
| load_zria_from_hub() | |