Run this model with HF Jobs
Run replicate/quantization-bitsandbytes 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/replicate/quantization-bitsandbytes. 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/replicate/quantization-bitsandbytes 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 replicate/quantization-bitsandbytes with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/quantization-bitsandbytes with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("replicate/quantization-bitsandbytes", version=1) - Notebooks
- Google Colab
- Kaggle
Build uploaded using `kernels`.
Browse filesFiles changed (13)
- .gitattributes+2
- build/torch28-cxx11-cpu-x86_64-linux/__init__.pyAdded+3
- build/torch28-cxx11-cpu-x86_64-linux/_ops.pyAdded+9
- build/torch28-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_2e2ed43.abi3.soAdded+3
- build/torch28-cxx11-cpu-x86_64-linux/custom_ops.pyAdded+19
- build/torch28-cxx11-cpu-x86_64-linux/metadata.jsonAdded+1
- build/torch28-cxx11-cpu-x86_64-linux/quantization_bitsandbytes/__init__.pyAdded+26
- build/torch29-cxx11-cpu-x86_64-linux/__init__.pyAdded+3
- build/torch29-cxx11-cpu-x86_64-linux/_ops.pyAdded+9
- build/torch29-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_2e2ed43.abi3.soAdded+3
- build/torch29-cxx11-cpu-x86_64-linux/custom_ops.pyAdded+19
- build/torch29-cxx11-cpu-x86_64-linux/metadata.jsonAdded+1
- build/torch29-cxx11-cpu-x86_64-linux/quantization_bitsandbytes/__init__.pyAdded+26
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines333435363732 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textbuild/torch28-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_2e2ed43.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch29-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_2e2ed43.abi3.so filter=lfs diff=lfs merge=lfs -text
123from .custom_ops import gemm_4bit_forward
__all__ = ["gemm_4bit_forward"]123456789import torchfrom . import _quantization_bitsandbytes_2e2ed43ops = torch.ops._quantization_bitsandbytes_2e2ed43
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_quantization_bitsandbytes_2e2ed43::{op_name}"123version https://git-lfs.github.com/spec/v1oid sha256:781ce29ce3dd3835d530e7791405a349066c98f5f4b3ef0de068603503eb754asize 14102412345678910111213141516171819import torchfrom ._ops import ops
def gemm_4bit_forward( input: torch.Tensor, weight: torch.Tensor, absmax: torch.Tensor, blocksize: int, quant_type: int,) -> torch.Tensor: original_dtype = input.dtype if original_dtype != torch.bfloat16: input = input.to(torch.bfloat16)
output = ops.gemm_4bit_forward(input, weight, absmax, blocksize, quant_type) if original_dtype != torch.bfloat16: output = output.to(original_dtype)
return output1{"python-depends":[]}1234567891011121314151617181920212223242526import ctypesimport sys
import importlibfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123from .custom_ops import gemm_4bit_forward
__all__ = ["gemm_4bit_forward"]123456789import torchfrom . import _quantization_bitsandbytes_2e2ed43ops = torch.ops._quantization_bitsandbytes_2e2ed43
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_quantization_bitsandbytes_2e2ed43::{op_name}"123version https://git-lfs.github.com/spec/v1oid sha256:f0f8dec5f3193767239147d3511f1455e487e96f9d9a5cd21f0d58eefa6646ccsize 14105612345678910111213141516171819import torchfrom ._ops import ops
def gemm_4bit_forward( input: torch.Tensor, weight: torch.Tensor, absmax: torch.Tensor, blocksize: int, quant_type: int,) -> torch.Tensor: original_dtype = input.dtype if original_dtype != torch.bfloat16: input = input.to(torch.bfloat16)
output = ops.gemm_4bit_forward(input, weight, absmax, blocksize, quant_type) if original_dtype != torch.bfloat16: output = output.to(original_dtype)
return output1{"python-depends":[]}1234567891011121314151617181920212223242526import ctypesimport sys
import importlibfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py"))).gitattributes+2
build/torch28-cxx11-cpu-x86_64-linux/__init__.pyAdded+3
build/torch28-cxx11-cpu-x86_64-linux/_ops.pyAdded+9
build/torch28-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_2e2ed43.abi3.soAdded+3
build/torch28-cxx11-cpu-x86_64-linux/custom_ops.pyAdded+19
build/torch28-cxx11-cpu-x86_64-linux/metadata.jsonAdded+1
build/torch28-cxx11-cpu-x86_64-linux/quantization_bitsandbytes/__init__.pyAdded+26
build/torch29-cxx11-cpu-x86_64-linux/__init__.pyAdded+3
build/torch29-cxx11-cpu-x86_64-linux/_ops.pyAdded+9
build/torch29-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_2e2ed43.abi3.soAdded+3
build/torch29-cxx11-cpu-x86_64-linux/custom_ops.pyAdded+19
build/torch29-cxx11-cpu-x86_64-linux/metadata.jsonAdded+1
build/torch29-cxx11-cpu-x86_64-linux/quantization_bitsandbytes/__init__.pyAdded+26