huggingfaceimporter

command
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2021 License: BSD-2-Clause Imports: 3 Imported by: 0

README

Hugging Face Importer

Import a Pre-Trained Model

spaGO allows you either to use a model in the inference phase or to train one from scratch, or fine-tune it. However, training a language model (i.e. the transformer objective) to get competitive results can become prohibitive. This applies in general, but even more so with spaGO as it does not currently use the GPU 😱

Pre-trained (fine-tuned) transformer models exist for several languages and are publicly hosted on the Hugging Face models repository.

Particularly, these exist for BERT, ELECTRA and BART the three types of transformers architectures currently supported by spaGO.

Build

Move into the top directory, and run the following command:

GOARCH=amd64 go build -o huggingface-importer cmd/huggingfaceimporter/main.go 

Usage

To import a pre-trained model, run the huggingface-importer indicating both the model name you'd like to import ( including organization), and a local directory where to store all your models.

Example:

./huggingface-importer --model=deepset/bert-base-cased-squad2 --repo=~/.spago 

At the end of the process, you should see:

Serializing model to "~/.spago/deepset/bert-base-cased-squad2/spago_model.bin"... ok
BERT has been converted successfully!

The directory ~/.spago/deepset/bert-base-cased-squad2 should contains the original Hugging Face files plus the files generated by spaGO: spago_model.bin and embeddings_storage.

The Docker version can be run like this.

docker run --rm -it -v ~/.spago:/tmp/spago spago:main huggingface-importer --model=deepset/bert-base-cased-squad2 --repo=/tmp/spago

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL