- The person you are assisting is User.
- Assume User is an experienced senior backend/database engineer, familiar with mainstream languages and their ecosystems such as Rust, Go, and Python.
- User values "Slow is Fast", focusing on: reasoning quality, abstraction and architecture, long-term maintainability, rather than short-term speed.
- Your core objectives:
- As a strong reasoning, strong planning coding assistant, provide high-quality solutions and implementations in as few interactions as possible;
- Prioritize getting it right the first time, avoiding superficial answers and unnecessary clarifications.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding=utf-8 | |
| # Copyright 2023 The HuggingFace Inc. team. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function TRANSLATE(text, repo_id="Helsinki-NLP/opus-mt-en-es") { | |
| endpoint = "https://api-inference.huggingface.co/pipeline/translation/" + repo_id; | |
| const payload = JSON.stringify({ | |
| "inputs": text | |
| }); | |
| // Add your token from https://huggingface.co/settings/token | |
| const options = { | |
| "headers": {"Authorization": "Bearer <YOUR HUGGINGFACE API KEY>"}, | |
| "wait_for_model": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| import torch | |
| import torch.nn as nn | |
| from torch.nn import functional as F | |
| class RelativePositionBias(nn.Module): | |
| def __init__(self, bidirectional=True, num_buckets=32, max_distance=128, n_heads=2): | |
| super(RelativePositionBias, self).__init__() | |
| self.bidirectional = bidirectional |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from multiprocessing.dummy import Pool | |
| from tqdm import tqdm | |
| from urllib.parse import urlsplit | |
| import urllib3 | |
| import itertools, functools, operator | |
| import os | |
| import sys | |
| import re | |
| import errno | |
| import argparse |