{"id":19428934,"url":"https://github.com/eleutherai/lm_perplexity","last_synced_at":"2025-07-19T22:42:29.355Z","repository":{"id":65410540,"uuid":"325376609","full_name":"EleutherAI/lm_perplexity","owner":"EleutherAI","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-05T23:49:03.000Z","size":549,"stargazers_count":148,"open_issues_count":2,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-24T18:48:46.770Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EleutherAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2020-12-29T20:03:28.000Z","updated_at":"2025-03-31T15:05:27.000Z","dependencies_parsed_at":"2023-01-23T05:16:08.658Z","dependency_job_id":null,"html_url":"https://github.com/EleutherAI/lm_perplexity","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EleutherAI/lm_perplexity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EleutherAI%2Flm_perplexity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EleutherAI%2Flm_perplexity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EleutherAI%2Flm_perplexity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EleutherAI%2Flm_perplexity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EleutherAI","download_url":"https://codeload.github.com/EleutherAI/lm_perplexity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EleutherAI%2Flm_perplexity/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266033444,"owners_count":23867053,"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-11-10T14:17:17.088Z","updated_at":"2025-07-19T22:42:29.307Z","avatar_url":"https://github.com/EleutherAI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lm_perplexity\n\nCode for benchmarking language models with the Pile.\n\n## Usage\n\nEvaluating on GPT-2 (uses GPU):\n\n```bash\n# Compute intermediate outputs for calculating perplexity (e.g. logprobs)\npython lm_perplexity/save_lm_perplexity_data.py \\\n    --model_config_path preset_configs/gpt2_medium.json \\\n    --data_path /path/to/mydata.jsonl.zst \\\n    --output_path /path/to/perplexity_data.p\n\n# Use intermediate outputs to compute perplexity\npython lm_perplexity/compute_perplexity.py \\\n    --perplexity_data_path /path/to/perplexity_data.p \\\n    --output_path /path/to/perplexity.json\n```\n\nEvaluating on GPT-3 (requires OpenAI API key):\n\n```bash\n# Compute intermediate outputs for calculating perplexity (e.g. logprobs)\nexport OPENAI_API_SECRET_KEY=YOUR_KEY_HERE\npython lm_perplexity/run_lm_perplexity.py \\\n    --model_config_path preset_configs/gpt3_curie.json \\\n    --data_path /path/to/mydata.jsonl.zst \\\n    --output_path /path/to/perplexity_data.p\n\n# Use intermediate outputs to compute perplexity\npython lm_perplexity/compute_perplexity.py \\\n    --perplexity_data_path /path/to/perplexity_data.p \\\n    --output_path /path/to/perplexity.json\n```\n\n## Assets\n\nJSON files in `assets/${DATASET}/group${GROUP_ID}.json` contain the document indices for the canonical one-tenth split of the test set. Evaluation in the paper were performed on `group0`. \n\n## Requirements\n\n* numpy\n* torch\n* transformers\n* openai\n* lm_dataformat\n* tqdm","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feleutherai%2Flm_perplexity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feleutherai%2Flm_perplexity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feleutherai%2Flm_perplexity/lists"}