Skip to content

Commit

Permalink
docs: add latency units in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienbanse committed Jul 1, 2024
1 parent d37faa4 commit 9b076d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions ecologits/impacts/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ def generation_latency(
request_latency: float,
) -> float:
"""
Compute the token generation latency.
Compute the token generation latency in seconds.
Args:
model_active_parameter_count: Number of active parameters of the model.
output_token_count: Number of generated tokens.
gpu_latency_alpha: Alpha parameter of the GPU linear latency profile.
gpu_latency_beta: Beta parameter of the GPU linear latency profile.
request_latency: Measured request latency (upper bound).
request_latency: Measured request latency (upper bound) in seconds.
Returns:
The token generation latency.
The token generation latency in seconds.
"""
gpu_latency = output_token_count * (gpu_latency_alpha * model_active_parameter_count + gpu_latency_beta)
return min(gpu_latency, request_latency)
Expand Down Expand Up @@ -129,7 +129,7 @@ def server_energy(
Compute the energy consumption of the server.
Args:
generation_latency: Token generation latency.
generation_latency: Token generation latency in seconds.
server_power: Power consumption of the server.
server_gpu_count: Number of available GPUs in the server.
gpu_required_count: Number of required GPUs to load the model.
Expand Down Expand Up @@ -294,7 +294,7 @@ def request_embodied_gwp(
Args:
server_gpu_embodied_gwp: GWP embodied impact of the server and the GPUs.
server_lifetime: Lifetime duration of the server.
generation_latency: Token generation latency.
generation_latency: Token generation latency in seconds.
Returns:
The GWP embodied impact of the request.
Expand All @@ -314,7 +314,7 @@ def request_embodied_adpe(
Args:
server_gpu_embodied_adpe: ADPe embodied impact of the server and the GPUs.
server_lifetime: Lifetime duration of the server.
generation_latency: Token generation latency.
generation_latency: Token generation latency in seconds.
Returns:
The ADPe embodied impact of the request.
Expand All @@ -334,7 +334,7 @@ def request_embodied_pe(
Args:
server_gpu_embodied_pe: PE embodied impact of the server and the GPUs.
server_lifetime: Lifetime duration of the server.
generation_latency: Token generation latency.
generation_latency: Token generation latency in seconds.
Returns:
The PE embodied impact of the request.
Expand Down Expand Up @@ -374,7 +374,7 @@ def compute_llm_impacts_dag(
model_active_parameter_count: Number of active parameters of the model.
model_total_parameter_count: Number of parameters of the model.
output_token_count: Number of generated tokens.
request_latency: Measured request latency.
request_latency: Measured request latency in seconds.
model_quantization_bits: Number of bits used to represent the model weights.
gpu_energy_alpha: Alpha parameter of the GPU linear power consumption profile.
gpu_energy_beta: Beta parameter of the GPU linear power consumption profile.
Expand Down Expand Up @@ -440,7 +440,7 @@ def compute_llm_impacts(
model_active_parameter_count: Number of active parameters of the model.
model_total_parameter_count: Number of total parameters of the model.
output_token_count: Number of generated tokens.
request_latency: Measured request latency.
request_latency: Measured request latency in seconds.
**kwargs: Any other optional parameter.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion ecologits/tracers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def llm_impacts(
provider: Name of the provider.
model_name: Name of the LLM used.
output_token_count: Number of generated tokens.
request_latency: Measured request latency.
request_latency: Measured request latency in seconds.
Returns:
The impacts of an LLM generation request.
Expand Down

0 comments on commit 9b076d5

Please sign in to comment.