Skip to content

Commit

Permalink
fix: lru cache HF get model params (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorr1 committed Jul 2, 2023
1 parent b745617 commit fd7fbc9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
0.1.9 - Unreleased
---------------------
Fixed
^^^^^
* Added trust code params HF models
* Added LRU cache to HF model param calls to avoid extra calls

0.1.8 - 2023-05-22
---------------------
Expand Down
2 changes: 2 additions & 0 deletions manifest/clients/diffuser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Diffuser client."""
import logging
from functools import lru_cache
from typing import Any, Dict, Optional

import numpy as np
Expand Down Expand Up @@ -79,6 +80,7 @@ def supports_streaming_inference(self) -> bool:
"""
return False

@lru_cache(maxsize=1)
def get_model_params(self) -> Dict:
"""
Get model params.
Expand Down
2 changes: 2 additions & 0 deletions manifest/clients/huggingface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Hugging Face client."""
import logging
from functools import lru_cache
from typing import Any, Dict, Optional

import requests
Expand Down Expand Up @@ -73,6 +74,7 @@ def supports_streaming_inference(self) -> bool:
"""
return False

@lru_cache(maxsize=1)
def get_model_params(self) -> Dict:
"""
Get model params.
Expand Down
2 changes: 2 additions & 0 deletions manifest/clients/huggingface_embedding.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Hugging Face client."""
import logging
from functools import lru_cache
from typing import Any, Dict, Optional, Tuple

import numpy as np
Expand Down Expand Up @@ -65,6 +66,7 @@ def supports_streaming_inference(self) -> bool:
"""
return False

@lru_cache(maxsize=1)
def get_model_params(self) -> Dict:
"""
Get model params.
Expand Down

0 comments on commit fd7fbc9

Please sign in to comment.