services: MoondreamService model_id argument is now model

This commit is contained in:
Aleix Conchillo Flaqué
2024-05-14 18:34:10 -07:00
parent e4fe54cd7f
commit bd5344c892
2 changed files with 5 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `MoondreamService` argument `model_id` is now `model`.
- `VADAnalyzer` arguments have been renamed for more clarity.
## [0.0.12] - 2024-05-14

View File

@@ -46,7 +46,7 @@ def detect_device():
class MoondreamService(VisionService):
def __init__(
self,
model_id="vikhyatk/moondream2",
model="vikhyatk/moondream2",
revision="2024-04-02",
use_cpu=False
):
@@ -58,12 +58,12 @@ class MoondreamService(VisionService):
device = torch.device("cpu")
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...")
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)
self._model.eval()