langfun 0.1.2.dev202409220803__py3-none-any.whl → 0.1.2.dev202409240804__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.
langfun/core/eval/base.py CHANGED
@@ -215,6 +215,7 @@ class Evaluable(lf.Component):
215
215
  summary: bool = True,
216
216
  pivot_field: str = 'lm',
217
217
  from_root: bool = True,
218
+ timeout: int | None = None,
218
219
  **kwargs,
219
220
  ) -> Union['Summary', pg.Dict]:
220
221
  """Run the evaluation, which fills and returns the result."""
@@ -265,6 +266,7 @@ class Evaluable(lf.Component):
265
266
  verbose=verbose,
266
267
  progress_bar=progress_bar,
267
268
  label=label,
269
+ timeout=timeout,
268
270
  **kwargs,
269
271
  )
270
272
 
@@ -398,6 +400,7 @@ class Evaluable(lf.Component):
398
400
  verbose: bool,
399
401
  progress_bar: int | None,
400
402
  label: str | None,
403
+ timeout: int | None = None,
401
404
  **kwargs,
402
405
  ) -> None:
403
406
  """Run the evaluate and fill `self.result`. Subclass to implement."""
@@ -1106,6 +1109,7 @@ class Evaluation(Evaluable):
1106
1109
  verbose: bool,
1107
1110
  progress_bar: int | None,
1108
1111
  label: str | None,
1112
+ timeout: int | None = None,
1109
1113
  **kwargs,
1110
1114
  ) -> None:
1111
1115
  # Setup examples.
@@ -1136,6 +1140,7 @@ class Evaluation(Evaluable):
1136
1140
  max_workers=self.max_workers,
1137
1141
  show_progress=progress_bar or False,
1138
1142
  status_fn=self._status,
1143
+ timeout=timeout,
1139
1144
  ):
1140
1145
  if error is not None:
1141
1146
  message = (
@@ -237,6 +237,8 @@ class VertexAI(lf.LanguageModel):
237
237
  # API. We should revisit this later.
238
238
  retry_on_errors = [
239
239
  (Exception, 'InternalServerError'),
240
+ (Exception, 'ResourceExhausted'),
241
+ (Exception, '_InactiveRpcError'),
240
242
  (
241
243
  Exception,
242
244
  (
@@ -247,11 +249,9 @@ class VertexAI(lf.LanguageModel):
247
249
  (Exception, 'ValueError: Cannot get the Candidate text.'),
248
250
  ]
249
251
 
250
- return lf.concurrent_execute(
252
+ return self._parallel_execute_with_currency_control(
251
253
  self._sample_single,
252
254
  prompts,
253
- executor=self.resource_id,
254
- max_workers=self.max_concurrency,
255
255
  retry_on_errors=retry_on_errors,
256
256
  )
257
257
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langfun
3
- Version: 0.1.2.dev202409220803
3
+ Version: 0.1.2.dev202409240804
4
4
  Summary: Langfun: Language as Functions.
5
5
  Home-page: https://github.com/google/langfun
6
6
  Author: Langfun Authors
@@ -44,7 +44,7 @@ langfun/core/coding/python/parsing_test.py,sha256=9vAWF484kWIm6JZq8NFiMgKUDhXV-d
44
44
  langfun/core/coding/python/permissions.py,sha256=1QWGHvzL8MM0Ok_auQ9tURqZHtdOfJaDpBzZ29GUE-c,2544
45
45
  langfun/core/coding/python/permissions_test.py,sha256=w5EDb8QxpxgJyZkojyzVWQvDfg366zn99-g__6TbPQ0,2699
46
46
  langfun/core/eval/__init__.py,sha256=Ogdr9OtTywhhLPHi3AZzOD2mXX2oyaHWflrSTMm96uA,1899
47
- langfun/core/eval/base.py,sha256=xDZQ3lu5oJaPDZCE5-QbBEajq--HRU64GVKb3xB64aI,74738
47
+ langfun/core/eval/base.py,sha256=4GX9kBbgzNPxa5G9n_b6tYSMqz4qFEdio-FMdd3q68A,74898
48
48
  langfun/core/eval/base_test.py,sha256=iL-EEGnBD_HigClBwo34HVyOycupgw9r4S61eIZMShI,26929
49
49
  langfun/core/eval/matching.py,sha256=124Y6pCb4fDmhICH728aeROZ6nNFitKyV6FFLklCe1k,9840
50
50
  langfun/core/eval/matching_test.py,sha256=f7iVyXH5KGJBWt4Wp14Bt9J3X59A6Ayfog9MbuFvPew,5532
@@ -67,7 +67,7 @@ langfun/core/llms/openai.py,sha256=vnDrKuD-pli0AtDIDq_TmlltOk7z7_PQ-xpU4K1ARdU,1
67
67
  langfun/core/llms/openai_test.py,sha256=UcBFW_7RkkMEo47Tn5RuVRK_DryTN7bb9ITphlzthE8,17762
68
68
  langfun/core/llms/rest.py,sha256=laopuq-zD8V-3Y6eFDngftHEbE66VlUkCD2-rvvRaLU,3388
69
69
  langfun/core/llms/rest_test.py,sha256=NZ3Nf0XQVpT9kLP5cBVo_yBHLI7vWTYhWQxYEJVMGs4,3472
70
- langfun/core/llms/vertexai.py,sha256=mEQVwO3Kf3rGRmsI-qKrV6vg0hYy6OH1lEVOM81cb3U,15134
70
+ langfun/core/llms/vertexai.py,sha256=hQR8eghtvPCH9l4fvuFkfV51UOiACH705Le5bmwEBDc,15164
71
71
  langfun/core/llms/vertexai_test.py,sha256=EPR-mB2hNUpvpf7E8m_k5bh04epdQTVUuYU6hPgZyu8,10321
72
72
  langfun/core/llms/cache/__init__.py,sha256=QAo3InUMDM_YpteNnVCSejI4zOsnjSMWKJKzkb3VY64,993
73
73
  langfun/core/llms/cache/base.py,sha256=rt3zwmyw0y9jsSGW-ZbV1vAfLxQ7_3AVk0l2EySlse4,3918
@@ -119,8 +119,8 @@ langfun/core/templates/demonstration.py,sha256=vCrgYubdZM5Umqcgp8NUVGXgr4P_c-fik
119
119
  langfun/core/templates/demonstration_test.py,sha256=SafcDQ0WgI7pw05EmPI2S4v1t3ABKzup8jReCljHeK4,2162
120
120
  langfun/core/templates/selfplay.py,sha256=yhgrJbiYwq47TgzThmHrDQTF4nDrTI09CWGhuQPNv-s,2273
121
121
  langfun/core/templates/selfplay_test.py,sha256=rBW2Qr8yi-aWYwoTwRR-n1peKyMX9QXPZXURjLgoiRs,2264
122
- langfun-0.1.2.dev202409220803.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
123
- langfun-0.1.2.dev202409220803.dist-info/METADATA,sha256=YRWAMsEemDNXZYDHFJNQhIDe2Fe078c0wTgqPewgyr0,8890
124
- langfun-0.1.2.dev202409220803.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
125
- langfun-0.1.2.dev202409220803.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
126
- langfun-0.1.2.dev202409220803.dist-info/RECORD,,
122
+ langfun-0.1.2.dev202409240804.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
123
+ langfun-0.1.2.dev202409240804.dist-info/METADATA,sha256=kCh02atnx1LxuIXm99gMgBT9AhZYqTEIQ6CNWlKFgJk,8890
124
+ langfun-0.1.2.dev202409240804.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
125
+ langfun-0.1.2.dev202409240804.dist-info/top_level.txt,sha256=RhlEkHxs1qtzmmtWSwYoLVJAc1YrbPtxQ52uh8Z9VvY,8
126
+ langfun-0.1.2.dev202409240804.dist-info/RECORD,,