qqubb commited on
Commit
8b7ecaf
·
1 Parent(s): 6d40ad6

corrections for gpai_model_obligations checks

Browse files
__pycache__/compliance_analysis.cpython-310.pyc CHANGED
Binary files a/__pycache__/compliance_analysis.cpython-310.pyc and b/__pycache__/compliance_analysis.cpython-310.pyc differ
 
compliance_analysis.py CHANGED
@@ -1,10 +1,6 @@
1
  import yaml
2
  from utils import set_operator_role_and_location, set_eu_market_status, check_within_scope_cc, check_within_scope_act, check_prohibited
3
 
4
- # Create some variables we will use throughout our analysis
5
-
6
-
7
-
8
  # TODO tells the user where the compliance analysis failed
9
  # TODO cite article from yaml file as explanation
10
 
@@ -13,7 +9,7 @@ def check_overall_compliance(cards):
13
  dispositive_variables = {
14
  "ai_project_type": {
15
  "ai_system": False,
16
- "gpai_model": False,
17
  "high_risk_ai_system": True,
18
  "gpai_model_systematic_risk": False
19
  },
@@ -145,45 +141,42 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
145
  if project_cc_yaml['gpai_models_with_systemic_risk_obligations'][f'{key}']['value'] == True:
146
  dispositive_variables['msg'].append("GPAI model with systematic risk fails the transparency requirements under Article 55.")
147
 
148
- for key, value in project_cc_yaml['gpai_model_obligations']:
149
- if not value:
150
- dispositive_variables['msg'].append("GPAI model fails the transparency requirements under Article 53.")
151
-
152
- # if dispositive_variables['ai_project_type']['ai_system'] == True:
153
-
154
-
155
 
156
  return dispositive_variables
157
 
158
  def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
159
 
160
- # # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
161
- # if high risk
162
- # for key, value in data_cc_yaml['data_and_data_governance']:
163
- # if not value:
164
- # msg = (f"Because of the dataset represented by , this high-risk AI system fails the data and data governance requirements under Article 10.")
165
- # for key, value in data_cc_yaml['technical_documentation']:
166
- # if not value:
167
- # msg = (f"Because of the dataset represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
168
- # for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
169
- # if not value:
170
- # msg = (f"Because of the dataset represented by , this high-risk AI system fails the transparency requirements under Article 13.")
171
- # for key, value in data_cc_yaml['quality_management_system']:
172
- # if not value:
173
- # msg = (f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
174
 
175
- # if gpai
176
- # for key, value in data_cc_yaml['gpai_requirements']['gpai_requirements']:
177
- # # if not value:
178
- # # msg = (f"Because of the dataset represented by {filename}, this GPAI fails the transparency requirements under Article 53.")
179
 
180
 
181
- # # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
182
- # # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
183
- # # 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
184
- # # intended purposes. That might look like this:
185
- # # if data_cc_yaml['intended_purpose'] not in intended_purposes:
186
- # # return false
187
 
188
  return dispositive_variables
189
 
 
1
  import yaml
2
  from utils import set_operator_role_and_location, set_eu_market_status, check_within_scope_cc, check_within_scope_act, check_prohibited
3
 
 
 
 
 
4
  # TODO tells the user where the compliance analysis failed
5
  # TODO cite article from yaml file as explanation
6
 
 
9
  dispositive_variables = {
10
  "ai_project_type": {
11
  "ai_system": False,
12
+ "gpai_model": True,
13
  "high_risk_ai_system": True,
14
  "gpai_model_systematic_risk": False
15
  },
 
141
  if project_cc_yaml['gpai_models_with_systemic_risk_obligations'][f'{key}']['value'] == True:
142
  dispositive_variables['msg'].append("GPAI model with systematic risk fails the transparency requirements under Article 55.")
143
 
144
+ for obligation_cat in project_cc_yaml['gpai_model_obligations']:
145
+ for obligation in project_cc_yaml['gpai_model_obligations'][f'{obligation_cat}']:
146
+ if project_cc_yaml['gpai_model_obligations'][f'{obligation_cat}'][f'{obligation}']['value'] == True:
147
+ dispositive_variables['msg'].append("GPAI model fails the transparency requirements under Article 53.")
 
 
 
148
 
149
  return dispositive_variables
150
 
151
  def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
152
 
153
+ # TODO: we probably have to pass ai_project_type and project_intended_purpose into this function
154
+ if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
155
+ for key, value in data_cc_yaml['data_and_data_governance']:
156
+ if not value:
157
+ msg = (f"Because of the dataset represented by , this high-risk AI system fails the data and data governance requirements under Article 10.")
158
+ for key, value in data_cc_yaml['technical_documentation']:
159
+ if not value:
160
+ msg = (f"Because of the dataset represented by , this high-risk AI system fails the technical documentation requirements under Article 11.")
161
+ for key, value in data_cc_yaml['transparency_and_provision_of_information_to_deployers']:
162
+ if not value:
163
+ msg = (f"Because of the dataset represented by , this high-risk AI system fails the transparency requirements under Article 13.")
164
+ for key, value in data_cc_yaml['quality_management_system']:
165
+ if not value:
166
+ msg = (f"Because of the dataset represented by , this high-risk AI system fails the quality management requirements under Article 17.")
167
 
168
+ if dispositive_variables['ai_project_type']["gpai_model"] == True:
169
+ for key, value in data_cc_yaml['gpai_requirements']['gpai_requirements']:
170
+ if not value:
171
+ msg = (f"Because of the dataset represented by {filename}, this GPAI fails the transparency requirements under Article 53.")
172
 
173
 
174
+ # TODO: No matter where we land with an orchestrator function, this function must also check to the value that has been set for both
175
+ # GPAI models with and without systemic risk and then check to see if the relevant requirements have met if either of these values applies.
176
+ # 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
177
+ # intended purposes. That might look like this:
178
+ # if data_cc_yaml['intended_purpose'] not in intended_purposes:
179
+ # return false
180
 
181
  return dispositive_variables
182
 
project_cc.yaml CHANGED
@@ -590,7 +590,7 @@ gpai_model_obligations:
590
  model_architecture:
591
  article: 'Art. 53(1)(a); Annex XI(1)(1)(d)'
592
  verbose: 'The provider has drawn up and will keep up-to-date technical documentation of the model that include a general description of the model that includes the architecture and number of parameters'
593
- value: !!bool false
594
  modality:
595
  article: 'Art. 53(1)(a); Annex XI(1)(1)(e)'
596
  verbose: 'The provider has drawn up and will keep up-to-date technical documentation of the model that include a general description of the model that includes the modality (e.g. text, image) and format of inputs and outputs'
@@ -682,6 +682,7 @@ gpai_models_with_systemic_risk_obligations:
682
  notification:
683
  article: 'Art 52(1)'
684
  verbose: 'Within two weeks of it being known that the AI project should be classified as a GPAI model with systemtic ris, tkhe Commission was notified and provided with the information that supports this finding'
 
685
  evaluation:
686
  article: 'Art. 55(1)(a)'
687
  verbose: 'The AI project was subject to a model evaluation using standardized protocols'
 
590
  model_architecture:
591
  article: 'Art. 53(1)(a); Annex XI(1)(1)(d)'
592
  verbose: 'The provider has drawn up and will keep up-to-date technical documentation of the model that include a general description of the model that includes the architecture and number of parameters'
593
+ value: !!bool true
594
  modality:
595
  article: 'Art. 53(1)(a); Annex XI(1)(1)(e)'
596
  verbose: 'The provider has drawn up and will keep up-to-date technical documentation of the model that include a general description of the model that includes the modality (e.g. text, image) and format of inputs and outputs'
 
682
  notification:
683
  article: 'Art 52(1)'
684
  verbose: 'Within two weeks of it being known that the AI project should be classified as a GPAI model with systemtic ris, tkhe Commission was notified and provided with the information that supports this finding'
685
+ value: false
686
  evaluation:
687
  article: 'Art. 55(1)(a)'
688
  verbose: 'The AI project was subject to a model evaluation using standardized protocols'