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 lines1031041051061061071081091101111091101141111121131141151191201211161171181191201271281291301211221231248 unmodified lines13313413514514614713613713839 unmodified lines178179180193194195196181182183184102 unmodified lines
class RepoEmbeddingPipeline(Pipeline): def __init__(self, github_token=None, st_messager=None, *args, **kwargs): def __init__(self, github_token=None, *args, **kwargs): super().__init__(*args, **kwargs)
# Streamlit single element container created by st.empty() self.st_messager = st_messager
self.API_HEADERS = {"Accept": "application/vnd.github+json"} if not github_token: message = ( 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" ) 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) print("[+] GitHub token set")
def _sanitize_parameters(self, **kwargs): _forward_kwargs = {}8 unmodified lines if 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 lines
pbar.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) tqdm.write(f"[*] Generating embeddings for {repo_name}")
code_embeddings = [] for func in repo_info["funcs"]:pipeline.py+4-19