Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
probicheaux committed May 14, 2024
1 parent f6e0d3a commit 0dbeac5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 6 additions & 4 deletions inference/core/interfaces/http/http_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
ClipTextEmbeddingRequest,
)
from inference.core.entities.requests.cogvlm import CogVLMInferenceRequest
from inference.core.entities.requests.paligemma import PaliGemmaInferenceRequest
from inference.core.entities.requests.doctr import DoctrOCRInferenceRequest
from inference.core.entities.requests.gaze import GazeDetectionInferenceRequest
from inference.core.entities.requests.groundingdino import GroundingDINOInferenceRequest
Expand All @@ -33,6 +32,7 @@
KeypointsDetectionInferenceRequest,
ObjectDetectionInferenceRequest,
)
from inference.core.entities.requests.paligemma import PaliGemmaInferenceRequest
from inference.core.entities.requests.sam import (
SamEmbeddingRequest,
SamSegmentationRequest,
Expand All @@ -51,7 +51,6 @@
ClipEmbeddingResponse,
)
from inference.core.entities.responses.cogvlm import CogVLMResponse
from inference.core.entities.responses.paligemma import PaliGemmaInferenceResponse
from inference.core.entities.responses.doctr import DoctrOCRInferenceResponse
from inference.core.entities.responses.gaze import GazeDetectionInferenceResponse
from inference.core.entities.responses.inference import (
Expand All @@ -64,6 +63,7 @@
StubResponse,
)
from inference.core.entities.responses.notebooks import NotebookStartResponse
from inference.core.entities.responses.paligemma import PaliGemmaInferenceResponse
from inference.core.entities.responses.sam import (
SamEmbeddingResponse,
SamSegmentationResponse,
Expand All @@ -83,10 +83,10 @@
ALLOW_ORIGINS,
CORE_MODEL_CLIP_ENABLED,
CORE_MODEL_COGVLM_ENABLED,
CORE_MODEL_PALIGEMMA_ENABLED,
CORE_MODEL_DOCTR_ENABLED,
CORE_MODEL_GAZE_ENABLED,
CORE_MODEL_GROUNDINGDINO_ENABLED,
CORE_MODEL_PALIGEMMA_ENABLED,
CORE_MODEL_SAM_ENABLED,
CORE_MODEL_YOLO_WORLD_ENABLED,
CORE_MODELS_ENABLED,
Expand Down Expand Up @@ -1390,7 +1390,9 @@ async def paligemma(
M.PaliGemmaResponse: The model's text response
"""
logger.debug(f"Reached /llm/paligemma")
paligemma_model_id = load_paligemma_model(inference_request, api_key=api_key)
paligemma_model_id = load_paligemma_model(
inference_request, api_key=api_key
)
response = await self.model_manager.infer_from_request(
paligemma_model_id, inference_request
)
Expand Down
16 changes: 7 additions & 9 deletions inference/models/paligemma/paligemma.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
import os
from inference.core.env import MODEL_CACHE_DIR
from PIL import Image

import torch
from PIL import Image
from transformers import AutoProcessor, PaliGemmaForConditionalGeneration

from inference.core.env import MODEL_CACHE_DIR

cache_dir = os.path.join(MODEL_CACHE_DIR)
import time
Expand All @@ -17,11 +19,7 @@

from inference.core.entities.requests.paligemma import PaliGemmaInferenceRequest
from inference.core.entities.responses.paligemma import PaliGemmaInferenceResponse
from inference.core.env import (
API_KEY,
PALIGEMMA_VERSION_ID,
MODEL_CACHE_DIR,
)
from inference.core.env import API_KEY, MODEL_CACHE_DIR, PALIGEMMA_VERSION_ID
from inference.core.models.base import PreprocessReturnMetadata
from inference.core.models.roboflow import RoboflowCoreModel
from inference.core.utils.image_utils import load_image_rgb
Expand All @@ -46,7 +44,7 @@ def __init__(self, *args, model_id=f"paligemma/{PALIGEMMA_VERSION_ID}", **kwargs
).eval()

self.processor = AutoProcessor.from_pretrained(
self.cache_dir,
self.cache_dir,
)
self.task_type = "lmm"

Expand Down

0 comments on commit 0dbeac5

Please sign in to comment.