{"id":17141058,"url":"https://github.com/zphang/nlprunners","last_synced_at":"2025-08-02T12:34:59.838Z","repository":{"id":116145772,"uuid":"200107335","full_name":"zphang/nlprunners","owner":"zphang","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-13T07:41:14.000Z","size":1184,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-29T13:43:36.508Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zphang.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":"2019-08-01T19:21:46.000Z","updated_at":"2020-04-25T22:15:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"770f5bad-9670-4ab8-9e05-3e149c866275","html_url":"https://github.com/zphang/nlprunners","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zphang%2Fnlprunners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zphang%2Fnlprunners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zphang%2Fnlprunners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zphang%2Fnlprunners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zphang","download_url":"https://codeload.github.com/zphang/nlprunners/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245232916,"owners_count":20581703,"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":[],"created_at":"2024-10-14T20:24:14.266Z","updated_at":"2025-03-24T08:17:44.608Z","avatar_url":"https://github.com/zphang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NLP Runners\n\nThis repository contains code for various NLP fine-tuning/transfer learning experiments, including semi-supervised learning, multi-task training, and adapters. \n\n**This codebase is heavily WIP.**\n\n---- \n\n### Quick Setup\n\n* For a quick environment setup, see: [Simple Setup](packaging/simple_setup.md)\n* For Adapters/Multi-Adapters, see: [Adapters/Multi-Adapters](packaging/adapters.md)\n\n----\n\n### Dependencies\n\nThese are the main notable dependencies. For more, see: [Simple Setup](packaging/simple_setup.md)\n\n* PyTorch 1.2+\n* HuggingFace/Transformers (usually the latest version. Currently 2.3.0)\n* My own set of Python utility libraries: [zutils](https://github.com/zphang/zutils)\n\n----\n\n### Overview\n\n#### Running\n\n* Different research projects can be found in [nlpr/proj](nlpr/proj). The basic fine-tuning version can be found in [nlpr/proj/simple](nlpr/proj/simple).\n* Each proj has one or more run scripts (`runscript.py`). Run scripts are the command-line scripts for kicking off a run, but also a good entry point for reading code.\n* Run scripts use a `zconf.RunConfiguration` object, which allows for easy command-line or in-session instantiation of arguments. Importantly, you can use the `--ZZsrc {path.json}` argument to specify a JSON file that provides keys/values that correspond to the attributes of the `RunConfiguration` for more convenient instantiation of a configuration/script.\n* More broadly, we make heavy use of JSON files for various configuration (e.g. model configs, task configs)\n* `Runner` objects contain the core logic for the training/eval loop of a project. Often, the goal of a runscript is simply to setup the `Runner` object and let the `Runner` object do all the work.\n\n#### Tasks\n\n* Tasks are defined in [nlpr/tasks/lib](nlpr/tasks/lib), one per file.\n* Each task broadly needs to specify the following: \n    * loading data\n    * tokenization (`Example.tokenize`), giving a `TokenizedExmaple`. \n    * featurization (`TokenizedExample.featurize`), giving a `DataRow`. This converts the tokenized data into a format that the model can take in (e.g. concatenating inputs, truncating sequence length, adding `[SEP]` tokens.)\n    * Conversion to a `Batch` (Batch.from_data_rows`), that our dataloaders know how to split up ` \n\n----\n\n### Guiding Principles\n\n* Use simple data formats (dictionaries, JSON/JSONL for serialization)\n* Code should be straightforward to run either on command-line or within notebooks. See: `zconf` from [zutils](https://github.com/zphang/zutils)\n* Explicit is better than implicit. Use classes rather than dicts for known data structures, refrain from using `kwargs`, use keyword arguments where possible, etc\n* Verbose is better than implicit. Use an IDE.\n* There should be a clean separation of messy \"research\" code, and solid \"software engineering\" code.\n* [PEP 8](https://www.python.org/dev/peps/pep-0008/), [PEP 20](https://www.python.org/dev/peps/pep-0020/) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzphang%2Fnlprunners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzphang%2Fnlprunners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzphang%2Fnlprunners/lists"}