Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/blog/240321_hugot/240321_hugot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Hugot

https://github.com/knights-analytics/hugot

> The goal of this library is to provide an easy, scalable, and hassle-free way to run huggingface transformer pipelines in golang applications.

Let's see how easy it is (on Mac).

## Installation

1. Getting the tokenizers

```
git clone https://github.com/Knights-Analytics/tokenizers -b main && \
cd tokenizers && \
cargo build --release
mv target/release/libtokenizers.a /usr/lib/libtokenizers.a
```

but rust was not updated, so I ran `rustup update` and then the above commands. But instead got `mv: fastcopy: open() failed (to): /usr/lib/libtokenizers.a: Operation not permitted`. This is because of SIP (System Integrity Protection) on Mac. So, let's try to instead move it to `/usr/local/lib`.

At the same time, I realized I just ran the `cargo build --release` command, but I'm not sure if that built it for the right architecture. So, I'll instead download the pre-built binary from the releases page of [github.com/daulet/tokenizers](https://github.com/daulet/tokenizers/releases). I downloaded the ` libtokenizers.darwin-arm64.tar.gz` for my M2 Max, untared it, and moved it with (which I needed `sudo` for).

2. Getting the ONNX runtime

I downloaded the `onnxruntime-osx-arm64-1.17.1.tgz` from the [ONNX runtime releases page](https://github.com/microsoft/onnxruntime/releases), untared it, and moved `libonnxruntime.1.17.1.dylib` to `/usr/local/lib` and renamed it to `libonnxruntime.dylib`.

```bash
sudo cp ~/Downloads/onnxruntime-osx-arm64-1.17.1/lib/libonnxruntime.1.17.1.dylib /usr/local/lib/libonnxruntime.dylib
```


https://www.izumanetworks.com/blog/build-docker-on-apple-m/