{"id":16494725,"url":"https://github.com/devrimcavusoglu/nonwestlit","last_synced_at":"2026-02-28T05:03:02.545Z","repository":{"id":249778080,"uuid":"704926805","full_name":"devrimcavusoglu/nonwestlit","owner":"devrimcavusoglu","description":"NONWESTLIT Project Codebase","archived":false,"fork":false,"pushed_at":"2025-02-10T09:45:49.000Z","size":245,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T20:40:47.919Z","etag":null,"topics":["dataset","low-resource-languages","low-resource-nlp","multilingual"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2407.15136","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devrimcavusoglu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-14T14:27:27.000Z","updated_at":"2025-02-10T09:45:55.000Z","dependencies_parsed_at":"2024-07-23T09:46:45.889Z","dependency_job_id":"9e91e457-6fc8-45ff-b082-2099470daccd","html_url":"https://github.com/devrimcavusoglu/nonwestlit","commit_stats":null,"previous_names":["devrimcavusoglu/nonwestlit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrimcavusoglu%2Fnonwestlit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrimcavusoglu%2Fnonwestlit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrimcavusoglu%2Fnonwestlit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devrimcavusoglu%2Fnonwestlit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devrimcavusoglu","download_url":"https://codeload.github.com/devrimcavusoglu/nonwestlit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245108166,"owners_count":20561998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataset","low-resource-languages","low-resource-nlp","multilingual"],"created_at":"2024-10-11T14:15:22.324Z","updated_at":"2026-02-28T05:03:02.439Z","avatar_url":"https://github.com/devrimcavusoglu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://site.unibo.it/nonwestlit/en/project/@@images/308d566c-4b9d-42c1-bcb6-d883a4057989.png\"\u003e\n\u003cbr\u003e\n\u003ca href=\"https://www.python.org/downloads/release/python-31011/\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/python-3.10-blue\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://arxiv.org/abs/2407.15136\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/arXiv-2407.15136-b31b15.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eNONWESTLIT\u003c/h1\u003e\n\n\nProject codebase for the paper [A multi-level multi-label text classification dataset of 19th century Ottoman and Russian literary and critical texts](https://arxiv.org/abs/2407.15136).\n\nThe objectives:\n\n* Linear probing to the SOTA LLMs (e.g. Llama-2, Falcon).\n* Fine-tune adapters e.g. LoRA.\n\n## Setup\n\nFor the project environment and dependency management we use conda. If you do not have conda, I recommend installing `miniconda` as opposed to `anaconda` as the latter is shipped with redundant packages most of which we don't use at all. The initial setup can be conducted as follows. \n\n```shell\ngit clone git@github.com:devrimcavusoglu/nonwestlit.git\ncd nonwestlit\nconda env create -f environment.yml\n```\n\nActivate the created conda environment by `conda activate nonwestlit`. \n\nThe following packages must be installed too for the integer quantization support (4bit \u0026 8bit).\n\n```shell\npip install bitsandbytes\u003e=0.41.2.post2  # For integer quantization support\npip install peft==0.7.1  # For LoRA adapters\n```\n\nAlso, add the project root directory to PYTHONPATH to develop more smoothly without experiencing any path related problems. For earlier `conda` versions this was possible by `conda develop \u003cproject root dir\u003e`, but it is [deprecated](https://github.com/conda/conda-build/issues/4251) (idk why?), so you can choose to manually add it to the PYTHONPATH. Heads up, this may require installing `conda-build` with miniconda.\n\nAn alternative way to add the project root to the PYTHONPATH permanently for the environment, try the following:\n\n1. Go to your conda dist. path (e.g. anaconda3, miniconda3, mamba) usually located at `$HOME/anaconda3`, from now on this path is referred as `CONDA_ROOT`\n2. Find the activation bash file located at `CONDA_ROOT/envs/nonwestlit/etc/conda/activate.d`, the file name under this is `libxml2_activate.sh` for conda version `4.14.0` (could be different for future versions).\n3. Open the file and add the following line and save and close it.\n    ```shell\n    export PYTHONPATH=\"${PYTHONPATH}:/path/to/project/root\"\n    ```\n4. Deactivate and reactivate the environment `nonwestlit`. The project root is now permanently added to PYTHONPATH.\n\n## Usage\n\nTo access the CLI and get information about available commands run the following:\n\n```shell\npython nonwestlit --help\n# or python nonwestlit \u003ccommand\u003e --help\n```\n\n❗**Important Note:** The terminal commands given below are only for demonstration purposes, and may not represent all \ncapability of the train arguments. The entry point `nonwestlit train` seamlessly support all HF TrainingArguments, \njust pass by the exact name and correct value. Please refer to [TrainingArguments](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments)\nto see all supported arguments for training.\n\nYou can start training by the following command at the project root. The following example training command was used \nfor training [nonwestlit/falcon-7b-lora-seq-cls](https://huggingface.co/nonwestlit/falcon-7b-lora-seq-cls).\n\n```shell\npython nonwestlit train --model-name-or-path tiiuae/falcon-7b --train-data-path data/data-json/train.json --eval-data-path data/data-json/val.json --output-dir outputs/falcon_7b_lora_seq_cls --adapter lora --lora-target-modules [\"query_key_value\"] --bnb-quantization 4bit --experiment-tracking 1 --num-labels 3 --save-strategy steps --save-steps 0.141 --save-total-limit 1 --per-device-train-batch-size 2 --weight-decay 0.1 --learning-rate 0.00003 --eval-steps 0.047 --bf16 1 --logging-steps 1 --num-train-epochs 7\n```\n\nThe help docs/docstrings are not there yet, it will soon be ready.\n\nFor prediction\n\n```shell\npython nonwestlit predict --model-name-or-path gpt2 --device cpu\n```\n\nGPT-2 is used for test purposes, so no harm trying the commands above (you will need for the tests anyway). GPT-2 used for high-level functionality tests (training and prediction).\n\n**Deepspeed**\n\nIt's currently experimental, and it is not yet available in the main branch, and it's not tested yet. You can only use w/ GPU's having Ampere arch. (RTX 3000 series+ or workstation GPUs).\n\n### Pushing the model to HF Hub\n\nUse the following command to push your trained model to the huggingface-hub.\n\n❗**Heads Up:** Before pushing the model to HF Hub you may want to remove the optimizer file saved along with the model, \nusually the optimizer binary files for big LLMs (e.g. llama-2, falcon) would be around 3 GB, and thus significantly \nslows down the uploading phase. Afaik, there is no way of certain ignoring files for huggingface-cli, so you have to \neither remove the optimizer file or move it outside the model directory.\n\n```shell\n  huggingface-cli upload nonwestlit LOCAL_MODEL_DIR HF_REPO_OR_MODEL_NAME --private --repo-type model\n```\n\n### Experiment Tracking\n\nWe are using Neptune.ai as an experiment tracking tool. To start logging neptune you need to create a simple config \nfile as below, and name it `neptune.cfg` which must reside under the project root. Enter values without any quotation \nmarks (shown in the example below).\n\n```cfg\n[credentials]\napi_token=\u003cYOUR_NEPTUNE_TOKEN\u003e\n\n[first-level-classification]\nproject=nonwestlit/first-level-classification\n\n[second-level-classification]\nproject=nonwestlit/second-level-classification\n\n# Append as necessary (if you create a new project)\n[project-key]\nproject=\u003cPROJECT_NAME\u003e\n```\n\nAlternatively, you can set them as environment variables for project to be logged in set `NEPTUNE_PROJECT`, and for \nthe API token set `NEPTUNE_API_TOKEN`. You can use `export` (MacOS, Linux) or `set` (Windows). For Linux you can \nset the environment variables as follows:\n\n```shell\nexport NEPTUNE_PROJECT=\u003cPROJECT_NAME\u003e \u0026\u0026 export NEPTUNE_API_TOKEN=\u003cYOUR_NEPTUNE_TOKEN\u003e\n```\n\nNote that, since these are set for those sessions only, you need to set these environment variables once they expire\n(e.g on reboot).\n\n## Development\n\nWe mainly use `black` for the code formatting. Use the following command to format the codebase.\n\n```shell\npython -m scripts.run_code_style format\n```\n\nTo check the code base is formatted, use\n\n```shell\npython -m scripts.run_code_style check\n```\n\nTo run tests, use\n\n```shell\npython -m scripts.run_tests\n```\n\n## Citation\n\nIf you use the dataset or code in your research, please cite our paper:\n\n```bibtex\n@inproceedings{gokceoglu-etal-2024-multi,\n    title = \"A multi-level multi-label text classification dataset of 19th century Ottoman and {R}ussian literary and critical texts\",\n    author = {Gokceoglu, Gokcen  and\n      {\\c{C}}avu{\\c{s}}o{\\u{g}}lu, Devrim  and\n      Akbas, Emre  and\n      Dolcerocca, {\\\"O}zen},\n    editor = \"Ku, Lun-Wei  and\n      Martins, Andre  and\n      Srikumar, Vivek\",\n    booktitle = \"Findings of the Association for Computational Linguistics: ACL 2024\",\n    month = aug,\n    year = \"2024\",\n    address = \"Bangkok, Thailand\",\n    publisher = \"Association for Computational Linguistics\",\n    url = \"https://aclanthology.org/2024.findings-acl.393/\",\n    doi = \"10.18653/v1/2024.findings-acl.393\",\n    pages = \"6585--6596\",\n    abstract = \"This paper introduces a multi-level, multi-label text classification dataset comprising over 3000 documents. The dataset features literary and critical texts from 19th-century Ottoman Turkish and Russian. It is the first study to apply large language models (LLMs) to this dataset, sourced from prominent literary periodicals of the era. The texts have been meticulously organized and labeled. This was done according to a taxonomic framework that takes into account both their structural and semantic attributes. Articles are categorized and tagged with bibliometric metadata by human experts. We present baseline classification results using a classical bag-of-words (BoW) naive Bayes model and three modern LLMs: multilingual BERT, Falcon, and Llama-v2. We found that in certain cases, Bag of Words (BoW) outperforms Large Language Models (LLMs), emphasizing the need for additional research, especially in low-resource language settings. This dataset is expected to be a valuable resource for researchers in natural language processing and machine learning, especially for historical and low-resource languages. The dataset is publicly available.\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevrimcavusoglu%2Fnonwestlit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevrimcavusoglu%2Fnonwestlit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevrimcavusoglu%2Fnonwestlit/lists"}