Skip to content

Commit

Permalink
isort all imports
Browse files Browse the repository at this point in the history
  • Loading branch information
vikhyat committed Nov 3, 2024
1 parent b371fc3 commit 5ce4fe8
Show file tree
Hide file tree
Showing 26 changed files with 87 additions and 477 deletions.
5 changes: 3 additions & 2 deletions batch_generate_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from moondream.hf import Moondream, detect_device, LATEST_REVISION
from transformers import AutoTokenizer
from PIL import Image
from transformers import AutoTokenizer

from moondream.hf import LATEST_REVISION, Moondream, detect_device

device, dtype = detect_device()

Expand Down
6 changes: 1 addition & 5 deletions clients/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Then download the model weights:
```
# int8 weights (recommended):
wget "https://huggingface.co/vikhyatk/moondream2/resolve/client/moondream-latest-int8.bin.gz?download=true" -O - | gunzip > moondream-latest-int8.bin
# ...or, for FP16 weights:
# ...or, for fp16 weights:
wget "https://huggingface.co/vikhyatk/moondream2/resolve/client/moondream-latest-f16.bin.gz?download=true" -O - | gunzip > moondream-latest-f16.bin
```

Expand Down Expand Up @@ -56,7 +56,3 @@ answer = model.answer_question(encoded_image, question)["answer"]
for t in model.answer_question(encoded_image, question, stream=True)["answer"]:
print(t, end="", flush=True)
```

### Accelerators

(TK -- document how ONNX execution providers work.)
3 changes: 2 additions & 1 deletion clients/python/moondream/preprocess.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from typing import List, Tuple, Union

import numpy as np
from PIL import Image


Expand Down
15 changes: 8 additions & 7 deletions clients/python/moondream/vl.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import onnx
import onnxruntime as ort
import numpy as np
import json
import os
import tarfile
import json

from typing import Generator, List, Union, Optional, Dict, TypedDict, Any
from PIL import Image
from dataclasses import dataclass
from io import BytesIO
from typing import Any, Dict, Generator, List, Optional, TypedDict, Union

import numpy as np
import onnxruntime as ort
from PIL import Image
from tokenizers import Tokenizer

import onnx

from .preprocess import create_patches


Expand Down
Loading

0 comments on commit 5ce4fe8

Please sign in to comment.