Respan instrumentation plugin for Hugging Face Transformers
Project description
respan-instrumentation-huggingface
Respan instrumentation plugin for Hugging Face Transformers.
This package wraps the upstream opentelemetry-instrumentation-transformers
instrumentor and adds a small Respan contract processor so
TextGenerationPipeline.__call__ spans export with canonical Respan fields.
Installation
pip install respan-ai respan-instrumentation-huggingface
Usage
from respan import Respan, workflow
from respan_instrumentation_huggingface import HuggingFaceInstrumentor
from transformers import pipeline
respan = Respan(
app_name="huggingface-text-generation",
instrumentations=[HuggingFaceInstrumentor()],
)
@workflow(name="huggingface_text_generation")
def run_generation():
generator = pipeline(
"text-generation",
model="sshleifer/tiny-gpt2",
)
return generator(
"Tracing helps teams",
max_length=30,
temperature=0.7,
top_p=0.9,
)
try:
print(run_generation())
finally:
respan.flush()
respan.shutdown()
Set TRACELOOP_TRACE_CONTENT=false to suppress prompt and completion text in
span attributes while still exporting model and request metadata.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file respan_instrumentation_huggingface-0.1.0.tar.gz.
File metadata
- Download URL: respan_instrumentation_huggingface-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42bb77a3c4fc385ed8e2a88eb32824cf88ef3cb305cb392a72ed05bf752915a4
|
|
| MD5 |
acce4f5e3b82923efe494fb651019e9b
|
|
| BLAKE2b-256 |
a303589a277f5d3f65d2c99c6d571f2db0364a78e3630a4f394882d8415fdbff
|
File details
Details for the file respan_instrumentation_huggingface-0.1.0-py3-none-any.whl.
File metadata
- Download URL: respan_instrumentation_huggingface-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78fc32d272a470f3c6a118396396b70b239e9d8242e0c1241c1141c7d9cd0956
|
|
| MD5 |
bfdb3c090e063cf224cf83402139f74c
|
|
| BLAKE2b-256 |
cb2f22be6b37e691d006b3d6e48b90caee0871be17ccea957521f6a5edd94ce5
|