mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-10-28 00:08:41 +00:00
chore: HuggingFaceLocalGenerator telemetry (#6070)
* add telemetry to pipelines 2.0 * only collect data if telemetry is on * reno * add downsampling * typing * manual tests * pylint * simplify code * Update haystack/preview/telemetry/__init__.py * look for _telemetry_data * rather index by component type * black * mypy * error handling * comment * review feedback & small improvements * defaultdict * stray changes * try-catch * method instead of attribute * fixes * remove print statements * lint * invert condition * always send the first event of the day * collect specs * track 2nd and 3rd events too * send first event and then max 1 event a minute * rename constant * black * add telemetry details to HuggingFaceLocalGenerator * add test * check if the model is a string --------- Co-authored-by: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com>
This commit is contained in:
parent
6b097928ff
commit
22a24c8477
@ -110,6 +110,14 @@ class HuggingFaceLocalGenerator:
|
|||||||
self.generation_kwargs = generation_kwargs
|
self.generation_kwargs = generation_kwargs
|
||||||
self.pipeline = None
|
self.pipeline = None
|
||||||
|
|
||||||
|
def _get_telemetry_data(self) -> Dict[str, Any]:
|
||||||
|
"""
|
||||||
|
Data that is sent to Posthog for usage analytics.
|
||||||
|
"""
|
||||||
|
if isinstance(self.pipeline_kwargs["model"], str):
|
||||||
|
return {"model": self.pipeline_kwargs["model"]}
|
||||||
|
return {"model": f"[object of type {type(self.pipeline_kwargs['model'])}]"}
|
||||||
|
|
||||||
def warm_up(self):
|
def warm_up(self):
|
||||||
if self.pipeline is None:
|
if self.pipeline is None:
|
||||||
self.pipeline = pipeline(**self.pipeline_kwargs)
|
self.pipeline = pipeline(**self.pipeline_kwargs)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user