Skip to content

Commit

Permalink
correct makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
philtweir committed Mar 23, 2023
1 parent 6f8daaf commit 8c0b645
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/target
/core/target
/core/ff_fasttext/*.so
/core/bonn/*.so
__pycache__
*.egg-info
Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "ff_fasttext"
name = "bonn"
version = "0.1.0"
edition = "2021"

Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@

## STAGE 1 - Core package(s)

FROM konstin2/maturin as maturin
FROM ghcr.io/pyo3/maturin:main as maturin

RUN mkdir -p /app/build/ff_fasttext
RUN mkdir -p /app/build/bonn
WORKDIR /app/build/test_data
# RUN curl -L -O "...wiki/wiki.en.fifu"
WORKDIR /app/build

RUN yum install -y lapack-devel atlas-devel
RUN yum install -y lapack-devel atlas-devel openblas-devel

COPY Cargo.lock /app/build
COPY Cargo.toml /app/build
COPY LICENSE.md /app/build

RUN RUSTFLAGS="-L /usr/lib64/atlas -C link-args=-lcblas -llapack" cargo install finalfusion-utils --features=opq
RUN RUSTFLAGS="-L /usr/lib64/atlas -C link-args=-lsatlas -ltatlas -llapack" cargo install finalfusion-utils --features=opq

COPY pyproject.toml /app/build
COPY src /app/build/src
COPY ff_fasttext /app/build/ff_fasttext
COPY bonn /app/build/bonn

WORKDIR /app/build
22 changes: 7 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ MAIN=build-dev

BUILD=build

CONTAINER_IMAGE=registry.gitlab.com/flaxandteal/onyx/ff_fasttext_poc:build-481688189
IMAGE_LATEST_TAG=registry.gitlab.com/flaxandteal/onyx/ff_fasttext_poc:latest
IMAGE_SHA_TAG=registry.gitlab.com/flaxandteal/onyx/ff_fasttext_poc:0321b497
CONTAINER_IMAGE=registry.gitlab.com/flaxandteal/onyx/bonn_poc:build-481688189
IMAGE_LATEST_TAG=registry.gitlab.com/flaxandteal/onyx/bonn_poc:latest
IMAGE_SHA_TAG=registry.gitlab.com/flaxandteal/onyx/bonn_poc:0321b497

GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
Expand All @@ -14,21 +14,13 @@ CYAN := $(shell tput -Txterm setaf 6)
RESET := $(shell tput -Txterm sgr0)

.PHONY: all
all: build-dev

.PHONY: wheels
wheels:
@mkdir -p $(BUILD)/wheels
docker build -t ff_fasttext_build -f Dockerfile.wheels .
docker run --rm --entrypoint maturin -v $(shell pwd)/$(BUILD)/wheels:/app/build/target/wheels ff_fasttext_build build
all: build

.PHONY: build
build: Dockerfile
docker build -t ${CONTAINER_IMAGE} -t ${IMAGE_LATEST_TAG} -t ${IMAGE_SHA_TAG} .

.PHONY: build-dev
build-dev: Dockerfile
docker-compose build
@mkdir -p $(BUILD)/wheels
docker build -t bonn_build -f Dockerfile .
docker run --rm --entrypoint maturin -v $(shell pwd)/$(BUILD)/wheels:/app/build/target/wheels bonn_build build

Dockerfile:
m4 Dockerfile.in > Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exit
#### Run

```bash
poetry run python -c "from ff_fasttext import FfModel; FfModel('test_data/wiki.en.fifu').eval('Hello')"
poetry run python -c "from bonn import FfModel; FfModel('test_data/wiki.en.fifu').eval('Hello')"
```

### Algorithm
Expand Down
4 changes: 2 additions & 2 deletions ff_fasttext/__init__.py → bonn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# import the contents of the Rust library into the Python extension
# optional: include the documentation from the Rust module
from .ff_fasttext import *
from .ff_fasttext import __all__, __doc__
from .bonn import *
from .bonn import __all__, __doc__
File renamed without changes.
2 changes: 1 addition & 1 deletion ff_fasttext/extract.py → bonn/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from nltk.stem.wordnet import WordNetLemmatizer

from .settings import settings
from ff_fasttext import FfModel
from bonn import FfModel
from .category_manager import CategoryManager
from .taxonomy import get_taxonomy, taxonomy_to_categories, categories_to_classifier_bow

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3.9" # optional since v1.27.0
services:
# this builds it with name category so either change this to ff_fasttext_api or change the name
# this builds it with name category so either change this to bonn_api or change the name
category:
build:
context: .
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn build_model(input_path: String, output_path: String) -> PyResult<()> {
}

#[pymodule]
fn ff_fasttext(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
fn bonn(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_class::<FfModel>()?;
m.add_function(wrap_pyfunction!(build_model, m)?)?;

Expand Down

0 comments on commit 8c0b645

Please sign in to comment.