services: MoondreamService model_id argument is now model
This commit is contained in:
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- `MoondreamService` argument `model_id` is now `model`.
|
||||||
|
|
||||||
- `VADAnalyzer` arguments have been renamed for more clarity.
|
- `VADAnalyzer` arguments have been renamed for more clarity.
|
||||||
|
|
||||||
## [0.0.12] - 2024-05-14
|
## [0.0.12] - 2024-05-14
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ def detect_device():
|
|||||||
class MoondreamService(VisionService):
|
class MoondreamService(VisionService):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
model_id="vikhyatk/moondream2",
|
model="vikhyatk/moondream2",
|
||||||
revision="2024-04-02",
|
revision="2024-04-02",
|
||||||
use_cpu=False
|
use_cpu=False
|
||||||
):
|
):
|
||||||
@@ -58,12 +58,12 @@ class MoondreamService(VisionService):
|
|||||||
device = torch.device("cpu")
|
device = torch.device("cpu")
|
||||||
dtype = torch.float32
|
dtype = torch.float32
|
||||||
|
|
||||||
self._tokenizer = AutoTokenizer.from_pretrained(model_id, revision=revision)
|
self._tokenizer = AutoTokenizer.from_pretrained(model, revision=revision)
|
||||||
|
|
||||||
logger.debug("Loading Moondream model...")
|
logger.debug("Loading Moondream model...")
|
||||||
|
|
||||||
self._model = AutoModelForCausalLM.from_pretrained(
|
self._model = AutoModelForCausalLM.from_pretrained(
|
||||||
model_id, trust_remote_code=True, revision=revision
|
model, trust_remote_code=True, revision=revision
|
||||||
).to(device=device, dtype=dtype)
|
).to(device=device, dtype=dtype)
|
||||||
self._model.eval()
|
self._model.eval()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user