File size: 875 Bytes
742dfc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from transformers import AutoConfig
import torch

def check_model(model_name):
    try:
        # Try to load the model configuration
        config = AutoConfig.from_pretrained(model_name)
        print("\nModel Configuration:")
        print(config)
        
        # Check if model_type is present
        print("\nModel Type:", config.model_type if hasattr(config, 'model_type') else 'Not specified')
        
        # Try to load the model
        print("\nAttempting to load model...")
        model = AutoModelForSequenceClassification.from_pretrained(
            model_name,
            torch_dtype=torch.float16,
            trust_remote_code=True
        )
        print("\nSuccessfully loaded model!")
        
    except Exception as e:
        print(f"\nError: {str(e)}")

if __name__ == "__main__":
    check_model("HabibBelguith44/Llama3-Tunisian-Dialect")