https://github.com/andstor/code-comment-analysis
Clustering of code comments
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.5%) to scientific vocabulary
Repository
Clustering of code comments
Basic Info
- Host: GitHub
- Owner: andstor
- Language: Jupyter Notebook
- Default Branch: main
- Size: 28 MB
Statistics
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
code-comment-analysis
Analysis of code comments using language models
Description
This repository contains code for the analysis of code comments using language models. It provides necessary scripts to generate embeddings and to perform clustering analysis on the generated embeddings.
Requirements
Dependencies
Install the Python dependencies defined in the requirements.txt.
bash
pip install -r requirements.txt
Accelerate
Setup accelerate:
bash
accelerate config
Usage
Generate embeddings
```bash usage: generate-embeddings.py [-h] [--datasetname DATASETNAME] [--datasetconfigname DATASETCONFIGNAME] [--datafiles [DATAFILES ...]] [--datasetsplit DATASETSPLIT] [--textcolumnnames [TEXTCOLUMNNAMES ...]] [--modelnameorpath MODELNAMEORPATH] [--configname CONFIGNAME] [--generationconfigfile GENERATIONCONFIGFILE] [--tokenizername TOKENIZERNAME] [--useslowtokenizer] [--outputfile OUTPUTFILE] [--seed SEED]
Do inference with a transformer model on a causal language modeling task
optional arguments: -h, --help show this help message and exit --datasetname DATASETNAME The name of the dataset to use (via the datasets library). Can also a be "csv", "json", "parquet" or "arrow" for loading a local or remote file. --datasetconfigname DATASETCONFIGNAME The configuration name of the dataset to use (via the datasets library). --datafiles [DATAFILES ...] A list of data files to use (a local dataset path or a url). --datasetsplit DATASETSPLIT The name of the split to use. Default to "train". --textcolumnnames [TEXTCOLUMNNAMES ...] The column names of the dataset to generate from. --modelnameorpath MODELNAMEORPATH Path to pretrained model or model identifier from huggingface.co/models. --configname CONFIGNAME Pretrained config name or path if not the same as modelname --generationconfigfile GENERATIONCONFIGFILE Generation config path if not the same as modelname --tokenizername TOKENIZERNAME Pretrained tokenizer name or path if not the same as modelname --useslowtokenizer If passed, will use a slow tokenizer (not backed by the 🤗 Tokenizers library). --outputfile OUTPUT_FILE The output jsonline file where the data will be saved. --seed SEED A seed for reproducible generation. ```
Example
The following example will load the data from the parquet and generate embeddings. The output will be saved to the specified jsonl file.
bash
accelerate launch script/generate-embeddings.py \
--dataset_name parquet \
--data_files generated_comments_slack_256.parquet \
--text_column_names generated func_code \
--model_name_or_path andstor/gpt-j-6B-smart-contract \
--output_file embeddings_generated_comments_slack_256.jsonl \
--seed 42
Owner
- Name: André Storhaug
- Login: andstor
- Kind: user
- Location: Trondheim 🇳🇴
- Company: NTNU
- Website: https://andre.storhaug.no
- Repositories: 87
- Profile: https://github.com/andstor
🎓 CS PhD student @ Norwegian University of Science and Technology (NTNU)
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0