Instructions to use openpecha/aligner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openpecha/aligner with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("openpecha/aligner") model = AutoModelForSeq2SeqLM.from_pretrained("openpecha/aligner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files- handler.py +16 -3
handler.py
CHANGED
|
@@ -229,9 +229,22 @@ def TemporaryDirectory():
|
|
| 229 |
shutil.rmtree(str(tmpdir))
|
| 230 |
|
| 231 |
|
| 232 |
-
def download_file(s3_public_url: str, output_fn) -> Path:
|
| 233 |
-
|
| 234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
r.raise_for_status()
|
| 236 |
with open(output_fn, "wb") as f:
|
| 237 |
for chunk in r.iter_content(chunk_size=8192):
|
|
|
|
| 229 |
shutil.rmtree(str(tmpdir))
|
| 230 |
|
| 231 |
|
| 232 |
+
# def download_file(s3_public_url: str, output_fn) -> Path:
|
| 233 |
+
# """Download file from a public S3 bucket URL."""
|
| 234 |
+
# with requests.get(s3_public_url, stream=True) as r:
|
| 235 |
+
# r.raise_for_status()
|
| 236 |
+
# with open(output_fn, "wb") as f:
|
| 237 |
+
# for chunk in r.iter_content(chunk_size=8192):
|
| 238 |
+
# f.write(chunk)
|
| 239 |
+
# return output_fn
|
| 240 |
+
def download_file(github_file_url: str, output_fn) -> Path:
|
| 241 |
+
"""Download file from github"""
|
| 242 |
+
headers = {
|
| 243 |
+
"Authorization": f"token {GITHUB_TOKEN}",
|
| 244 |
+
"Accept": "application/vnd.github+json",
|
| 245 |
+
}
|
| 246 |
+
authenticated_file_url = f"{github_file_url}?token={GITHUB_TOKEN}"
|
| 247 |
+
with requests.get(authenticated_file_url, headers=headers, stream=True) as r:
|
| 248 |
r.raise_for_status()
|
| 249 |
with open(output_fn, "wb") as f:
|
| 250 |
for chunk in r.iter_content(chunk_size=8192):
|