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
Revert "Build uploaded using `kernels`."
Browse filesThis reverts commit 0b643c8a514f7c1efec317ac1b9a7a753d88e042.
Files changed (18)
- build/torch210-cxx11-cpu-x86_64-linux/__init__.pyAdded+3
- build/torch210-cxx11-cpu-x86_64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_5679cec.abi3.soAdded+3
- build/torch210-cxx11-cpu-x86_64-linux/custom_ops.pyAdded+19
- build/torch210-cxx11-cpu-x86_64-linux/metadata.jsonAdded+1
- build/torch210-cxx11-cpu-x86_64-linux/quantization_bitsandbytes/__init__.pyAdded+26
- 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_5679cec.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_5679cec.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
123from .custom_ops import gemm_4bit_forward
__all__ = ["gemm_4bit_forward"]123456789import torchfrom . import _quantization_bitsandbytes_5679cecops = torch.ops._quantization_bitsandbytes_5679cec
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_quantization_bitsandbytes_5679cec::{op_name}"123version https://git-lfs.github.com/spec/v1oid sha256:9514e46dcde591876368977ade28c2f1852077ce89f737bfd9a4567706395003size 14671212345678910111213141516171819import 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_5679cecops = torch.ops._quantization_bitsandbytes_5679cec
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_quantization_bitsandbytes_5679cec::{op_name}"123version https://git-lfs.github.com/spec/v1oid sha256:f5a60273f0883e1bfee176864d939b3835fd7360336c8a7c985df178a4aac483size 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_5679cecops = torch.ops._quantization_bitsandbytes_5679cec
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_quantization_bitsandbytes_5679cec::{op_name}"123version https://git-lfs.github.com/spec/v1oid sha256:44b98e143bc9306dc5e4b5db487af05520152f44e4c5b93cdc19a4322d3f716fsize 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")))build/torch210-cxx11-cpu-x86_64-linux/__init__.pyAdded+3
build/torch210-cxx11-cpu-x86_64-linux/_ops.pyAdded+9
build/torch210-cxx11-cpu-x86_64-linux/_quantization_bitsandbytes_5679cec.abi3.soAdded+3
build/torch210-cxx11-cpu-x86_64-linux/custom_ops.pyAdded+19
build/torch210-cxx11-cpu-x86_64-linux/metadata.jsonAdded+1
build/torch210-cxx11-cpu-x86_64-linux/quantization_bitsandbytes/__init__.pyAdded+26
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_5679cec.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_5679cec.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