sapthesh commited on
Commit
c1e5327
·
verified ·
1 Parent(s): 047d22b

Update custom_model.py

Browse files
Files changed (1) hide show
  1. custom_model.py +2 -2
custom_model.py CHANGED
@@ -27,8 +27,8 @@ class CustomModel(PreTrainedModel):
27
  config = cls.config_class.from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
28
  # Initialize the model with the configuration
29
  model = cls(config)
30
- # Load the model weights using the transformers library
31
- model.encoder = AutoModel.from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
32
  return model
33
  except Exception as e:
34
  print(f"Failed to load model from {pretrained_model_name_or_path}. Error: {e}")
 
27
  config = cls.config_class.from_pretrained(pretrained_model_name_or_path, *args, **kwargs)
28
  # Initialize the model with the configuration
29
  model = cls(config)
30
+ # Optionally, you can load the state_dict here if needed
31
+ # model.load_state_dict(torch.load(os.path.join(pretrained_model_name_or_path, "pytorch_model.bin")))
32
  return model
33
  except Exception as e:
34
  print(f"Failed to load model from {pretrained_model_name_or_path}. Error: {e}")