truefoundry 0.11.5rc2__py3-none-any.whl → 0.11.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

@@ -187,7 +187,10 @@ def convert_deployment_config_to_python(
187
187
 
188
188
 
189
189
  def generate_python_snippet_for_trigger_job(
190
- application_fqn: str, command: Optional[str], params: Optional[Dict[str, str]]
190
+ application_fqn: str,
191
+ command: Optional[str],
192
+ params: Optional[Dict[str, str]],
193
+ run_name_alias: Optional[str],
191
194
  ):
192
195
  job_run_python_template = """\
193
196
  from truefoundry.deploy import trigger_job
@@ -195,8 +198,9 @@ from truefoundry.deploy import trigger_job
195
198
  response = trigger_job(
196
199
  application_fqn="{{application_fqn}}",
197
200
  # You can pass command or params, but not both
198
- # command={{command}}
199
- # params={{params}}
201
+ # command={{command}},
202
+ # params={{params}},
203
+ # run_name_alias={{run_name_alias}}
200
204
  )
201
205
 
202
206
  print(response.jobRunName)
@@ -220,6 +224,17 @@ print(response.jobRunName)
220
224
  output_python_str = output_python_str.replace(
221
225
  "{{params}}", "<Enter Params(key-value pairs) here as python dict>"
222
226
  )
227
+ if run_name_alias is not None:
228
+ output_python_str = output_python_str.replace(
229
+ "# run_name_alias", "run_name_alias"
230
+ )
231
+ output_python_str = output_python_str.replace(
232
+ "{{run_name_alias}}", repr(run_name_alias)
233
+ )
234
+ else:
235
+ output_python_str = output_python_str.replace(
236
+ "{{run_name_alias}}", "<Enter Run Name Alias here>"
237
+ )
223
238
 
224
239
  return output_python_str
225
240
 
@@ -229,6 +244,7 @@ def generate_curl_snippet_for_trigger_job(
229
244
  application_id: str,
230
245
  command: Optional[str],
231
246
  params: Optional[Dict[str, str]],
247
+ run_name_alias: Optional[str],
232
248
  ):
233
249
  job_run_curl_request_template = """curl -X 'POST' \\
234
250
  '{{control_plane_url}}/api/svc/v1/jobs/trigger' \\
@@ -237,7 +253,10 @@ def generate_curl_snippet_for_trigger_job(
237
253
  -H 'Content-Type: application/json' \\
238
254
  -d '{
239
255
  "applicationId": "{{application_id}}",
240
- "input": {{input}}
256
+ "input": {{input}},
257
+ "metadata": {
258
+ "job_run_name_alias": "{{run_name_alias}}"
259
+ }
241
260
  }'
242
261
  """
243
262
  output_curl_str = job_run_curl_request_template.replace(
@@ -247,4 +266,10 @@ def generate_curl_snippet_for_trigger_job(
247
266
  output_curl_str = output_curl_str.replace(
248
267
  "{{input}}", json.dumps({"command": command, "params": params}, indent=2)
249
268
  )
269
+ if run_name_alias is not None:
270
+ output_curl_str = output_curl_str.replace("{{run_name_alias}}", run_name_alias)
271
+ else:
272
+ output_curl_str = output_curl_str.replace(
273
+ "{{run_name_alias}}", "<Enter Run Name Alias here>"
274
+ )
250
275
  return output_curl_str
@@ -31,6 +31,7 @@ class TrueFoundryMLCallback(TrainerCallback):
31
31
  log_checkpoints: bool = True,
32
32
  checkpoint_artifact_name: Optional[str] = None,
33
33
  auto_end_run_on_train_end: bool = False,
34
+ log_training_arguments: bool = True,
34
35
  ):
35
36
  """
36
37
  Args:
@@ -38,7 +39,7 @@ class TrueFoundryMLCallback(TrainerCallback):
38
39
  log_checkpoints: Whether to log checkpoints or not, defaults to True.
39
40
  checkpoint_artifact_name: The name of the artifact to log checkpoints to, required if log_checkpoints is True.
40
41
  auto_end_run_on_train_end: Whether to end the run automatically when training ends, defaults to False.
41
-
42
+ log_training_arguments: Whether to log the training arguments or not, defaults to True.
42
43
  Usage:
43
44
  from transformers import Trainer
44
45
  from truefoundry.ml.integrations.huggingface.trainer_callback import TrueFoundryMLCallback
@@ -67,6 +68,7 @@ class TrueFoundryMLCallback(TrainerCallback):
67
68
  )
68
69
  self._checkpoint_artifact_name = checkpoint_artifact_name
69
70
  self._auto_end_run_on_train_end = auto_end_run_on_train_end
71
+ self._log_training_arguments = log_training_arguments
70
72
 
71
73
  @classmethod
72
74
  def with_managed_run(
@@ -76,6 +78,7 @@ class TrueFoundryMLCallback(TrainerCallback):
76
78
  log_checkpoints: bool = True,
77
79
  checkpoint_artifact_name: Optional[str] = None,
78
80
  auto_end_run_on_train_end: bool = True,
81
+ log_training_arguments: bool = True,
79
82
  ) -> "TrueFoundryMLCallback":
80
83
  """
81
84
  Args:
@@ -84,7 +87,7 @@ class TrueFoundryMLCallback(TrainerCallback):
84
87
  log_checkpoints: Whether to log checkpoints or not, defaults to True.
85
88
  checkpoint_artifact_name: The name of the artifact to log checkpoints to, required if log_checkpoints is True.
86
89
  auto_end_run_on_train_end: Whether to end the run automatically when training ends, defaults to True.
87
-
90
+ log_training_arguments: Whether to log the training arguments or not, defaults to True.
88
91
  Usage:
89
92
  from transformers import Trainer
90
93
  from truefoundry.ml.integrations.huggingface.trainer_callback import TrueFoundryMLCallback
@@ -109,6 +112,7 @@ class TrueFoundryMLCallback(TrainerCallback):
109
112
  log_checkpoints=log_checkpoints,
110
113
  checkpoint_artifact_name=checkpoint_artifact_name,
111
114
  auto_end_run_on_train_end=auto_end_run_on_train_end,
115
+ log_training_arguments=log_training_arguments,
112
116
  )
113
117
 
114
118
  def _drop_non_finite_values(self, dct: Dict[str, Any]) -> Dict[str, Any]:
@@ -184,6 +188,21 @@ class TrueFoundryMLCallback(TrainerCallback):
184
188
  description=description,
185
189
  )
186
190
 
191
+ def on_train_begin(
192
+ self,
193
+ args: "TrainingArguments",
194
+ state: "TrainerState",
195
+ control: "TrainerControl",
196
+ **kwargs,
197
+ ):
198
+ if self._log_training_arguments:
199
+ training_arguments = args.to_sanitized_dict()
200
+ valid_types = (bool, int, float, str)
201
+ training_arguments = {
202
+ k: v for k, v in training_arguments.items() if type(v) in valid_types
203
+ }
204
+ self._run.log_params(training_arguments)
205
+
187
206
  def on_train_end(
188
207
  self,
189
208
  args: "TrainingArguments",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truefoundry
3
- Version: 0.11.5rc2
3
+ Version: 0.11.7
4
4
  Summary: TrueFoundry CLI
5
5
  Author-email: TrueFoundry Team <abhishek@truefoundry.com>
6
6
  Requires-Python: <3.14,>=3.8.1
@@ -53,7 +53,7 @@ truefoundry/common/types.py,sha256=BMJFCsR1lPJAw66IQBSvLyV4I6o_x5oj78gVsUa9si8,1
53
53
  truefoundry/common/utils.py,sha256=P0FuAadoJGdpieUORLSN-PiFnkyoGO-K2cS4OPITBWg,6714
54
54
  truefoundry/common/warnings.py,sha256=xDMhR_-ZGC40Ycaj6nlFb5MYPexn8WbKCHd4FlflTXQ,705
55
55
  truefoundry/deploy/__init__.py,sha256=sP-6Nv-_uV2o3knWcNSGV07j_Hkq0lfUkfZffBg-Hfo,2874
56
- truefoundry/deploy/python_deploy_codegen.py,sha256=k19_m5DGsUyjOUCSKwIVP8vDna2sq01tHABsUfoVpW4,8019
56
+ truefoundry/deploy/python_deploy_codegen.py,sha256=WwP6bIzFoLpF7J2Bgef2HMSIeefJ8TWtSv4hXNycEzQ,8872
57
57
  truefoundry/deploy/_autogen/models.py,sha256=e75fSAlUJhPW3IN9Lg3ogSnCR9crIuHAsZaDSCNvkS0,75977
58
58
  truefoundry/deploy/builder/__init__.py,sha256=VR07ZB7ziONEBbVgg1JdRTWY7t4qJjJTMhc2VodXYdA,5036
59
59
  truefoundry/deploy/builder/constants.py,sha256=amUkHoHvVKzGv0v_knfiioRuKiJM0V0xW0diERgWiI0,508
@@ -359,7 +359,7 @@ truefoundry/ml/cli/commands/model_init.py,sha256=INyUAU6hiFClI8cZqX5hgnrtNbeKxlZ
359
359
  truefoundry/ml/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
360
  truefoundry/ml/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
361
361
  truefoundry/ml/integrations/huggingface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
- truefoundry/ml/integrations/huggingface/trainer_callback.py,sha256=Zu5AUbH_ct8I1dHyNYJQZBj9Y__hKo0sc2OxpPXJARE,6952
362
+ truefoundry/ml/integrations/huggingface/trainer_callback.py,sha256=Q_CT1Sy4OZ8LyHm2qruhAmp3H7emhJogSs2-hPsPK3k,7863
363
363
  truefoundry/ml/log_types/__init__.py,sha256=g4u4D4Jaj0aBK5GtrLV88-qThKZR9pSZ17vFEkN-LmM,125
364
364
  truefoundry/ml/log_types/plot.py,sha256=LDh4uy6z2P_a2oPM2lc85c0lt8utVvunohzeMawFjZw,7572
365
365
  truefoundry/ml/log_types/pydantic_base.py,sha256=eBlw_AEyAz4iJKDP4zgJOCFWcldwQqpf7FADW1jzIQY,272
@@ -386,7 +386,7 @@ truefoundry/workflow/remote_filesystem/__init__.py,sha256=LQ95ViEjJ7Ts4JcCGOxMPs
386
386
  truefoundry/workflow/remote_filesystem/logger.py,sha256=em2l7D6sw7xTLDP0kQSLpgfRRCLpN14Qw85TN7ujQcE,1022
387
387
  truefoundry/workflow/remote_filesystem/tfy_signed_url_client.py,sha256=xcT0wQmQlgzcj0nP3tJopyFSVWT1uv3nhiTIuwfXYeg,12342
388
388
  truefoundry/workflow/remote_filesystem/tfy_signed_url_fs.py,sha256=nSGPZu0Gyd_jz0KsEE-7w_BmnTD8CVF1S8cUJoxaCbc,13305
389
- truefoundry-0.11.5rc2.dist-info/METADATA,sha256=Pxl2_AUdbaHgeqxSo2h-b-gFmtLRGV1Ew5c0-2FX6jE,2763
390
- truefoundry-0.11.5rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
391
- truefoundry-0.11.5rc2.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
392
- truefoundry-0.11.5rc2.dist-info/RECORD,,
389
+ truefoundry-0.11.7.dist-info/METADATA,sha256=ydC2lFQf5iICc9uFTslsw4zS96saw6rWGDbcEup0zSc,2760
390
+ truefoundry-0.11.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
391
+ truefoundry-0.11.7.dist-info/entry_points.txt,sha256=xVjn7RMN-MW2-9f7YU-bBdlZSvvrwzhpX1zmmRmsNPU,98
392
+ truefoundry-0.11.7.dist-info/RECORD,,