Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor huggingface config support #742

Merged
5 changes: 5 additions & 0 deletions garak/configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def _apply_config(self, config):
)
):
continue
if isinstance(v, dict): # if value is an existing dictionary merge
v = getattr(self, k) | v
setattr(self, k, v) # This will set attribute to the full dictionary value

def _apply_missing_instance_defaults(self):
Expand All @@ -96,6 +98,9 @@ def _apply_missing_instance_defaults(self):
for k, v in self.DEFAULT_PARAMS.items():
if not hasattr(self, k):
setattr(self, k, v)
elif isinstance(v, dict):
v = v | getattr(self, k)
setattr(self, k, v)

def _validate_env_var(self):
if hasattr(self, "key_env_var"):
Expand Down
1 change: 1 addition & 0 deletions garak/generators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Generator(Configurable):

active = True
generator_family_name = None
parallel_capable = True
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tagging #361


# support mainstream any-to-any large models
# legal element for str list `modality['in']`: 'text', 'image', 'audio', 'video', '3d'
Expand Down
Loading
Loading