code for using this model from huggingface_hub import snapshot_download import json import torch from downloaded_model.main_model import Seq2Seq , generate_answer # Download model files from Hugging Face Hub snapshot_download(repo_id="DP27/test-ma-model", local_dir="downloaded_model") with open("./downloaded_model/config.json", "r") as f: config = json.load(f) vocab_size = config["vocab_size"] embedding_dim = config["embedding_dim"] hidden_dim = config["hidden_dim"] max_len = config["max_len"] # Initialize Model model = Seq2Seq(vocab_size, embedding_dim, hidden_dim) model.load_state_dict(torch.load("./downloaded_model/seq2seq_model.pth",weights_only=True)) model.eval() # Set model to evaluation mode with open("./downloaded_model/ma_vocab.json", "r") as f: vocab = json.load(f) # Create mappings word2idx = vocab idx2word = {idx: word for word, idx in vocab.items()} question = "what is MA?" answer = generate_answer(model, question, vocab=word2idx) print("Answer:", answer)