Feature Extraction
Transformers
PyTorch
roberta
code-understanding
unixcoder
text-embeddings-inference
Run this model with HF Jobs
Run Lazyhope/RepoSim on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Lazyhope/RepoSim. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Lazyhope/RepoSim on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Lazyhope/RepoSim with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lazyhope/RepoSim with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Lazyhope/RepoSim")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Lazyhope/RepoSim") model = AutoModel.from_pretrained("Lazyhope/RepoSim", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Remove st_messager from the pipeline for streamlit data cachability
Browse files102 unmodified lines1031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321338 unmodified lines14214314414514614714814915039 unmodified lines190191192193194195196197198199102 unmodified linesclass RepoEmbeddingPipeline(Pipeline):def __init__(self, github_token=None, st_messager=None, *args, **kwargs):super().__init__(*args, **kwargs)# Streamlit single element container created by st.empty()self.st_messager = st_messagerself.API_HEADERS = {"Accept": "application/vnd.github+json"}if not github_token:message = ("[*] Consider setting GitHub token to avoid hitting rate limits. \n""For more info, see: ""https://docs.github.com/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token")print(message)if self.st_messager:self.st_messager.info(message)else:self.set_github_token(github_token)def set_github_token(self, github_token):self.API_HEADERS["Authorization"] = f"Bearer {github_token}"message = "[+] GitHub token set"print(message)if self.st_messager:self.st_messager.success(message)def _sanitize_parameters(self, **kwargs):_forward_kwargs = {}8 unmodified linesif isinstance(inputs, str):inputs = [inputs]if self.st_messager:self.st_messager.info("[*] Downloading and extracting repos...")extracted_infos = download_and_extract(inputs, headers=self.API_HEADERS)return extracted_infos39 unmodified linespbar.set_description(f"Processing {repo_name}")message = f"[*] Generating embeddings for {repo_name}"tqdm.write(message)if self.st_messager:self.st_messager.info(message)code_embeddings = []for func in repo_info["funcs"]:102 unmodified lines1031041051061071081091101111121131141151161171181191201211221231248 unmodified lines13313413513613713839 unmodified lines178179180181182183184102 unmodified linesclass RepoEmbeddingPipeline(Pipeline):def __init__(self, github_token=None, *args, **kwargs):super().__init__(*args, **kwargs)self.API_HEADERS = {"Accept": "application/vnd.github+json"}if not github_token:print("[*] Consider setting GitHub token to avoid hitting rate limits. \n""For more info, see: ""https://docs.github.com/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token")else:self.set_github_token(github_token)def set_github_token(self, github_token):self.API_HEADERS["Authorization"] = f"Bearer {github_token}"print("[+] GitHub token set")def _sanitize_parameters(self, **kwargs):_forward_kwargs = {}8 unmodified linesif isinstance(inputs, str):inputs = [inputs]extracted_infos = download_and_extract(inputs, headers=self.API_HEADERS)return extracted_infos39 unmodified linespbar.set_description(f"Processing {repo_name}")tqdm.write(f"[*] Generating embeddings for {repo_name}")code_embeddings = []for func in repo_info["funcs"]:
pipeline.py+4-19