Skip to content

Commit

Permalink
Update macOS build workflow and standalone app
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfFan committed Feb 15, 2024
1 parent 6ecbdfa commit c76d020
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/build-mac.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build for macOS 12 (large)
name: Build for macOS 12 (Intel)

on:
push:
Expand Down Expand Up @@ -29,8 +29,13 @@ jobs:
pip install -U https://github.com/huggingface/transformers/archive/refs/heads/main.zip
pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu -U
pip install -r requirements.txt
- name: Build standalone app
run: |
cd standalone_app
pyenv local 3.11.7
pyinstaller Snap2LaTeX.spec
- name: Archive artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: built-artifacts
path: dist/
name: Snap2LaTeX.app
path: standalone_app/dist/Snap2LaTeX.app
4 changes: 2 additions & 2 deletions standalone_app/Snap2LaTeX.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
if __name__ == "__main__":

model_name = "Norm/nougat-latex-base"
device = "mps" if torch.cuda.is_available() else "mps"
device = "mps" if torch.backends.mps.is_available() else "cpu"
# init model
model = VisionEncoderDecoderModel.from_pretrained(model_name, device_map="mps")
model = VisionEncoderDecoderModel.from_pretrained(model_name, device_map=device)

# init processor
tokenizer = NougatTokenizerFast.from_pretrained(model_name)
Expand Down

0 comments on commit c76d020

Please sign in to comment.