Spaces:
Sleeping
Sleeping
wlmbrown
commited on
Commit
·
fbbf69b
1
Parent(s):
aa34bd2
changes to model and data analysis in compliance_analysis.py
Browse files- compliance_analysis.py +25 -49
- data_cc.yaml +1 -1
- model_cc.yaml +4 -4
compliance_analysis.py
CHANGED
@@ -156,69 +156,45 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
|
|
156 |
|
157 |
def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
|
158 |
|
159 |
-
#
|
160 |
-
|
161 |
-
|
162 |
-
# if not value:
|
163 |
-
# dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the data and data governance requirements under Article 10.")
|
164 |
-
# for key, value in data_cc_yaml['technical_documentation']:
|
165 |
-
# if not value:
|
166 |
-
# dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
|
167 |
-
# for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
|
168 |
-
# if not value:
|
169 |
-
# dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the transparency requirements under Article 13.")
|
170 |
-
# for key, value in data_cc_yaml['quality_management_system']:
|
171 |
-
# if not value:
|
172 |
-
# dispositive_variables['msg'].append(f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
|
173 |
-
|
174 |
-
if dispositive_variables['ai_project_type']["ai_system"] == True:
|
175 |
for value in data_cc_yaml['high_risk_ai_system_requirements']:
|
176 |
if data_cc_yaml['high_risk_ai_system_requirements'][f'{value}'] == True:
|
177 |
dispositive_variables['msg'].append(f"")
|
178 |
|
|
|
|
|
179 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
180 |
-
for value in data_cc_yaml['
|
181 |
-
if data_cc_yaml['
|
182 |
dispositive_variables['msg'].append(f"")
|
183 |
|
184 |
return dispositive_variables
|
185 |
|
186 |
def run_compliance_analysis_on_model(dispositive_variables, model_cc_yaml):
|
187 |
|
188 |
-
#
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
# if not value:
|
195 |
-
# msg = (f"Because of the model represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
|
196 |
-
# for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
|
197 |
-
# if not value:
|
198 |
-
# msg = (f"Because of the model represented by , this high-risk AI system fails the transparency requirements under Article 13.")
|
199 |
-
# for key, value in data_cc_yaml['accuracy_robustness_cybersecurity']:
|
200 |
-
# if not value:
|
201 |
-
# msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 15.")
|
202 |
-
# for key, value in data_cc_yaml['quality_management_system']:
|
203 |
-
# if not value:
|
204 |
-
# msg = (f"Because of the model represented by , this high-risk AI system fails the quality management requirements under Article 17.")
|
205 |
|
206 |
-
#
|
207 |
-
|
208 |
-
|
209 |
-
|
|
|
|
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
214 |
|
215 |
-
# # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
|
216 |
-
# # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
|
217 |
-
# # Right now it is only checking high-risk AI system requirements. Another thing that we likely have to add here is the cross-comparison of the
|
218 |
-
# # intended purposes. That might look like this:
|
219 |
-
# # if model_cc_yaml['intended_purpose'] not in intended_purposes:
|
220 |
-
# # return false
|
221 |
-
|
222 |
return dispositive_variables
|
223 |
|
224 |
def check_intended_purpose(dispositive_variables, project_cc, other_cc):
|
|
|
156 |
|
157 |
def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
|
158 |
|
159 |
+
# If project involves a high-risk AI system, then make sure all the relevant data requirements are met (relevant attributes are positive)
|
160 |
+
|
161 |
+
if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
for value in data_cc_yaml['high_risk_ai_system_requirements']:
|
163 |
if data_cc_yaml['high_risk_ai_system_requirements'][f'{value}'] == True:
|
164 |
dispositive_variables['msg'].append(f"")
|
165 |
|
166 |
+
# If project involves a GPAI model, then make sure all the relevant data requirements are met (relevant attributes are positive)
|
167 |
+
|
168 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
169 |
+
for value in data_cc_yaml['gpai_model_requirements']:
|
170 |
+
if data_cc_yaml['gpai_model_requirements'][f'{value}'] == True: # should this be false? BM
|
171 |
dispositive_variables['msg'].append(f"")
|
172 |
|
173 |
return dispositive_variables
|
174 |
|
175 |
def run_compliance_analysis_on_model(dispositive_variables, model_cc_yaml):
|
176 |
|
177 |
+
# If project involves a high-risk AI system, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
178 |
+
|
179 |
+
if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
|
180 |
+
for value in model_cc_yaml['high_risk_ai_system_requirements']:
|
181 |
+
if model_cc_yaml['high_risk_ai_system_requirements'][f'{value}'] == True:
|
182 |
+
dispositive_variables['msg'].append(f"")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
+
# If project involves a GPAI model, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
185 |
+
|
186 |
+
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
187 |
+
for value in model_cc_yaml['gpai_model_requirements']:
|
188 |
+
if model_cc_yaml['gpai_model_requirements'][f'{value}'] == True:
|
189 |
+
dispositive_variables['msg'].append(f"")
|
190 |
|
191 |
+
# If the GPAI model additionally carries systemic risk, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
192 |
+
|
193 |
+
if dispositive_variables['ai_project_type']["gpai_model_systemic_risk"] == True:
|
194 |
+
for value in model_cc_yaml['gpai_model_with_systemic_risk_requirements']:
|
195 |
+
if model_cc_yaml['gpai_model_requirements'][f'{value}'] == True:
|
196 |
+
dispositive_variables['msg'].append(f"")
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
return dispositive_variables
|
199 |
|
200 |
def check_intended_purpose(dispositive_variables, project_cc, other_cc):
|
data_cc.yaml
CHANGED
@@ -194,7 +194,7 @@ high_risk_ai_system_requirements:
|
|
194 |
|
195 |
# Meta data related to data-relaed requirements for GPAI models
|
196 |
|
197 |
-
|
198 |
data_type:
|
199 |
article: 'Art. 53(1); Annex XI(2)(c)'
|
200 |
verbose: 'Documentation for the dataset is available that contains the type of data'
|
|
|
194 |
|
195 |
# Meta data related to data-relaed requirements for GPAI models
|
196 |
|
197 |
+
gpai_model_requirements:
|
198 |
data_type:
|
199 |
article: 'Art. 53(1); Annex XI(2)(c)'
|
200 |
verbose: 'Documentation for the dataset is available that contains the type of data'
|
model_cc.yaml
CHANGED
@@ -70,7 +70,7 @@ classification_of_gpai_models:
|
|
70 |
|
71 |
# Metadata related to model-related requirements for high-risk AI systems
|
72 |
|
73 |
-
|
74 |
risk_management_system_general:
|
75 |
article: 'Art. 9(2)'
|
76 |
verbose: 'A risk management system has been planned, run, reviewed, and updated throughout the model lifecycle'
|
@@ -210,7 +210,7 @@ high_risk_ai_models:
|
|
210 |
|
211 |
# Meta data related to model-related requirements for GPAI models
|
212 |
|
213 |
-
|
214 |
task:
|
215 |
article: 'Art. 53; Annex XI(1)(1)(a)'
|
216 |
verbose: 'The tasks that the model is intended to perform and the type and nature of AI systems in which it can be integrated'
|
@@ -296,7 +296,7 @@ obligations_for_providers_of_gpai_models:
|
|
296 |
verbose: 'Where applicable, detailed description of the measures put in place for the purpose of conducting internal and/or external adversarial testing (e.g. red teaming), model adaptations, including alignment and fine-tuning'
|
297 |
value: !!bool false
|
298 |
|
299 |
-
|
300 |
evaluation:
|
301 |
article: 'Art. 55(1)(a)'
|
302 |
verbose: 'Perform model evaluation in accordance with standardised protocols and tools reflecting the state of the art, including conducting and documenting adversarial testing of the model with a view to identify and mitigate systemic risk'
|
@@ -312,7 +312,7 @@ obligations_for_providers_of_gpai_models_with_systemic_risk:
|
|
312 |
|
313 |
# Metadata related to transparency requirements for some AI systems (Article 50)
|
314 |
|
315 |
-
|
316 |
generates_media: # clean this up
|
317 |
article: 'Art. 50(2)'
|
318 |
verbose: 'If the model generates synthetic audio, image, video or text content'
|
|
|
70 |
|
71 |
# Metadata related to model-related requirements for high-risk AI systems
|
72 |
|
73 |
+
high_risk_ai_system_requirements:
|
74 |
risk_management_system_general:
|
75 |
article: 'Art. 9(2)'
|
76 |
verbose: 'A risk management system has been planned, run, reviewed, and updated throughout the model lifecycle'
|
|
|
210 |
|
211 |
# Meta data related to model-related requirements for GPAI models
|
212 |
|
213 |
+
gpai_model_requirements:
|
214 |
task:
|
215 |
article: 'Art. 53; Annex XI(1)(1)(a)'
|
216 |
verbose: 'The tasks that the model is intended to perform and the type and nature of AI systems in which it can be integrated'
|
|
|
296 |
verbose: 'Where applicable, detailed description of the measures put in place for the purpose of conducting internal and/or external adversarial testing (e.g. red teaming), model adaptations, including alignment and fine-tuning'
|
297 |
value: !!bool false
|
298 |
|
299 |
+
gpai_model_with_systemic_risk_requirements:
|
300 |
evaluation:
|
301 |
article: 'Art. 55(1)(a)'
|
302 |
verbose: 'Perform model evaluation in accordance with standardised protocols and tools reflecting the state of the art, including conducting and documenting adversarial testing of the model with a view to identify and mitigate systemic risk'
|
|
|
312 |
|
313 |
# Metadata related to transparency requirements for some AI systems (Article 50)
|
314 |
|
315 |
+
transparency_requirements:
|
316 |
generates_media: # clean this up
|
317 |
article: 'Art. 50(2)'
|
318 |
verbose: 'If the model generates synthetic audio, image, video or text content'
|