Package: famie
FAMIE: A Fast Active Learning Framework for Multilingual Information ExtractionIntroductionFAMIE is a comprehensive  and efficientactive learning(AL) toolkit formultilingual information extraction(IE). FAMIE is designed to address a fundamental problem in existing AL frameworks where annotators need to wait for a long time between annotation batches due to the time-consuming nature of model training and data selection at each AL iteration. With a novelproxy AL mechanismand the integration of our SOTA multilingual toolkitTrankit,it takes FAMIE only a few hours to provide users with a labeled dataset and a ready-to-use model for different IE tasks over100 languages.If you use FAMIE in your research or products, please cite our following paper:@inproceedings{vannguyen2022famie,title={FAMIE: A Fast Active Learning Framework for Multilingual Information Extraction},author={Nguyen, Minh Van and Ngo, Nghia Trung and Min, Bonan and Nguyen, Thien Huu},booktitle={Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies: Demonstrations},year={2022}}FAMIE's technical paper:https://arxiv.org/pdf/2202.08316.pdfFAMIE's documentation page:https://famie.readthedocs.ioFAMIE's demo website:http://nlp.uoregon.edu:9000/InstallationFAMIE can be easily installed via one of the following methods:Using pippip install famieThe command would install FAMIE and all dependent packages automatically.From sourcegit clone https://github.com/nlp-uoregon/famie.git
cd famie
pip install -e .This would first clone our github repo and install FAMIE.UsageFAMIE currently supports Named Entity Recognition, Event Detection, and Event Argument Extraction for over100 languages. Using FAMIE includes three following steps:Start an annotation session.Annotate data for a target task.Access the labeled data and a ready-to-use model returned by FAMIE.Starting an annotation sessionRunning on local machinesTo start an annotation session, please use the following command:famiestartThis will run a server on users' local machines (no data or models will leave users' local machines), users can access FAMIE's web interface via the URL:http://127.0.0.1:9000/Running on remote serversTo use FAMIE on a remote server for a local machine, users can run famie on the corresponding server and ssh-forward famie's port (9000) from their local machine:# On remotefamiestart# On localssh-NL<local-port>:localhost:<famie-port><remote-username>@<remote-address># Open localhost:9000 on local to access FAMIE's web interface.Running on Google ColabTo use FAMIE on google colab, usecolab-sshto create an ssh connect to the Colab VM. Then follow the same remote-local process above to run FAMIE on the colab notebook through your local machine.# On Colab Notebook## Install colab_ssh and run ngrok to get ssh address and port!pipinstallcolab_ssh--upgrade
fromcolab_sshimportlaunch_ssh
launch_ssh('YOUR_NGROK_AUTH_TOKEN','SOME_PASSWORD')# return a ssh-address and ssh-port## Run FAMIEfamiestart--port<famie-port># On localssh-NL<local-port>:localhost:<famie-port>root@<ssh-address>-p<ssh-port># Open localhost:<local-port> on local to access FAMIE's web interface.As FAMIE is an AL framework, it provides different data selection algorithms that recommend users the most beneficial examples to label at each annotation iteration. This is done via passing an optional argument--selection [mnlp|badge|bertkm|random].Annotating dataAfter initiating a new project and uploading an unlabeled dataset file with an entity types file (in text format), annotators can start the annotation process.
Given one annotation batch in an iteration, annotators label one sentence at a time, annotating the word spans for each label by first choosing the label and then highlighting the appropriate spans.After finishing each iteration, FAMIE then allows users to download the trained models and annotated data by clicking on the buttonsDOWNLOAD LABELED DATAandDOWNLOAD TRAINED MODEL.Accessing labeled data and trained modelsFAMIE also provides a simple and intuitive code
interface for interacting with the resulting labeled
dataset and trained main models after the AL processes.importfamie# access a project via its namep=famie.get_project('named-entity-recognition')# access the project's labeled datadata=p.get_labeled_data()# a Python dictionary# export the project's labeled data to a filep.export_labeled_data('data.json')# export the project's trained model to a filep.export_trained_model('model.ckpt')# access the project's trained modelmodel=p.get_trained_model()# access a trained model from filemodel=famie.load_model_from_file('model.ckpt')# use the trained model to make predictionsmodel.predict('Oregon is a beautiful state!')# ['B-Location', 'O', 'O', 'O', 'O']