Spaces:
Runtime error
Runtime error
Update custom_model.py
Browse files- 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 |
-
#
|
31 |
-
model.
|
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}")
|