Text Classification
Transformers
Safetensors
PEFT
branchone
feature-extraction
decision-model
multimodal
custom-code
custom_code
Instructions to use ndemirdemir/BranchOne with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ndemirdemir/BranchOne with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ndemirdemir/BranchOne", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ndemirdemir/BranchOne", trust_remote_code=True, device_map="auto") - PEFT
How to use ndemirdemir/BranchOne with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
Download build_causal_conv.py from ndemirdemir/BranchOne: direct link, hf CLI and curl.
- Browser
- Download file 2.9 kB
-
https://huggingface.co/ndemirdemir/BranchOne/resolve/main/build_causal_conv.py
- Command line
-
hf download hf://ndemirdemir/BranchOne/build_causal_conv.py
-
curl -L -o build_causal_conv.py https://huggingface.co/ndemirdemir/BranchOne/resolve/main/build_causal_conv.py
2.9 kB
| """Build the pinned fast convolution extension in the selected Colab environment.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| import os | |
| import subprocess | |
| import sys | |
| import urllib.request | |
| from pathlib import Path | |
| from cuda_toolchain import configure | |
| SOURCE_URL = "https://files.pythonhosted.org/packages/f4/d1/eba27735f31bd5527d39a3c7f693e6ded7b844cab275db719a15ad37b6cd/causal_conv1d-1.7.0.tar.gz" | |
| SOURCE_SHA256 = "3202758494eaa7b597ce1c282dfa188889506bfcb92cad3c407d26736bfcd32b" | |
| def digest(path): | |
| with Path(path).open("rb") as stream: | |
| return hashlib.file_digest(stream, "sha256").hexdigest() | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument( | |
| "--output", required=True, help="Build cache outside the public repository" | |
| ) | |
| parser.add_argument("--install", action="store_true") | |
| args = parser.parse_args() | |
| compiler = configure() | |
| os.environ["PATH"] = ( | |
| str(Path(sys.executable).parent) + os.pathsep + os.environ["PATH"] | |
| ) | |
| import torch | |
| if not torch.cuda.is_available() or torch.__version__ != "2.11.0+cu128": | |
| raise RuntimeError( | |
| "Use the recorded Torch CUDA 12.8 environment on the remote GPU" | |
| ) | |
| output = Path(args.output).resolve() | |
| output.mkdir(parents=True, exist_ok=True) | |
| source = output / "causal_conv1d-1.7.0.tar.gz" | |
| if not source.exists(): | |
| urllib.request.urlretrieve(SOURCE_URL, source) | |
| if digest(source) != SOURCE_SHA256: | |
| raise RuntimeError("Convolution source checksum mismatch") | |
| env = os.environ | { | |
| "MAX_JOBS": "4", | |
| "CAUSAL_CONV1D_FORCE_BUILD": "TRUE", | |
| "TORCH_CUDA_ARCH_LIST": "8.0;8.9", | |
| } | |
| subprocess.run( | |
| [ | |
| sys.executable, | |
| "-m", | |
| "pip", | |
| "wheel", | |
| "--verbose", | |
| "--no-build-isolation", | |
| "--no-deps", | |
| str(source), | |
| "--wheel-dir", | |
| str(output), | |
| ], | |
| check=True, | |
| env=env, | |
| ) | |
| wheels = list(output.glob("causal_conv1d-1.7.0-*.whl")) | |
| if len(wheels) != 1: | |
| raise RuntimeError( | |
| "Expected one wheel; use a clean build directory per Python/CUDA environment" | |
| ) | |
| if args.install: | |
| subprocess.run( | |
| [sys.executable, "-m", "pip", "install", "--no-deps", str(wheels[0])], | |
| check=True, | |
| ) | |
| record = { | |
| "source_url": SOURCE_URL, | |
| "source_sha256": SOURCE_SHA256, | |
| "wheel_sha256": digest(wheels[0]), | |
| "wheel": wheels[0].name, | |
| "torch": torch.__version__, | |
| "cuda": torch.version.cuda, | |
| "python": sys.version.split()[0], | |
| "installed": args.install, | |
| "compiler": compiler, | |
| } | |
| (output / "build.json").write_text(json.dumps(record, indent=2) + "\n") | |
| print(json.dumps(record), flush=True) | |
| if __name__ == "__main__": | |
| main() | |