Unverified Commit 5daad7e2 authored by Pavol Rusnak's avatar Pavol Rusnak Committed by GitHub
Browse files

python3Packages.{compressed-tensors,mistral-common,partial-json-parser}: init (#378782)

parents 8b564bb2 7ee9eb31
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  pydantic,
  torch,
  transformers,
  nbconvert,
  nbformat,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "compressed-tensors";
  version = "0.9.1";
  pyproject = true;

  # Release on PyPI is missing the `utils` directory, which `setup.py` wants to import
  src = fetchFromGitHub {
    owner = "neuralmagic";
    repo = pname;
    tag = version;
    hash = "sha256-AsbNFBvHxjiLl0T4JnQ5QrZdERUUYgS4iJvMRQytzN4=";
  };

  build-system = [ setuptools ];

  dependencies = [
    pydantic
    torch
    transformers
  ];

  doCheck = true;

  pythonImportsCheck = [ "compressed_tensors" ];

  nativeCheckInputs = [
    nbconvert
    nbformat
    pytestCheckHook
  ];

  disabledTests = [
    # these try to download models from HF Hub
    "test_get_observer_token_count"
    "test_kv_cache_quantization"
    "test_target_prioritization"
    "test_load_compressed_sharded"
    "test_save_compressed_model"
    "test_apply_tinyllama_dynamic_activations"
  ];

  disabledTestPaths = [
    # these try to download models from HF Hub
    "tests/test_quantization/lifecycle/test_apply.py"
  ];

  meta = with lib; {
    description = "A safetensors extension to efficiently store sparse quantized tensors on disk";
    homepage = "https://github.com/neuralmagic/compressed-tensors";
    license = licenses.asl20;
    maintainers = [ ];
  };
}
+57 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  poetry-core,
  numpy,
  pydantic,
  jsonschema,
  sentencepiece,
  typing-extensions,
  tiktoken,
  pillow,
  requests,
}:

buildPythonPackage rec {
  pname = "mistral-common";
  version = "1.5.2";
  pyproject = true;

  src = fetchPypi {
    pname = "mistral_common";
    inherit version;
    hash = "sha256-nRFXsTdsSdNav8dD2+AITyyjezpavQPnQSdqG8ZshS8=";
  };

  # relax dependencies
  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail 'pillow = "^10.3.0"' 'pillow = ">=10.3.0"' \
      --replace-fail 'tiktoken = "^0.7.0"' 'tiktoken = ">=0.7.0"' \
  '';

  build-system = [ poetry-core ];

  dependencies = [
    numpy
    pydantic
    jsonschema
    sentencepiece
    typing-extensions
    tiktoken
    pillow
    requests
  ];

  doCheck = true;

  pythonImportsCheck = [ "mistral_common" ];

  meta = with lib; {
    description = "mistral-common is a set of tools to help you work with Mistral models.";
    homepage = "https://github.com/mistralai/mistral-common";
    license = licenses.asl20;
    maintainers = with maintainers; [ bgamari ];
  };
}
+42 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  pdm-backend,
  tqdm,
  hypothesis,
  pytest,
}:

buildPythonPackage rec {
  pname = "partial-json-parser";
  version = "0.2.1.1.post5";
  pyproject = true;

  src = fetchPypi {
    pname = "partial_json_parser";
    inherit version;
    hash = "sha256-mScQrGfpCzZ5IdUnJ2mJKAQPdxO6fsszuWNx6nrsgso=";
  };

  build-system = [ pdm-backend ];

  dependencies = [ ];

  doCheck = true;

  pythonImportsCheck = [ "partial_json_parser" ];

  dev-dependencies = [
    hypothesis
    tqdm
    pytest
  ];

  meta = with lib; {
    description = "Parse partial JSON generated by LLM";
    homepage = "https://github.com/promplate/partial-json-parser";
    license = licenses.mit;
    maintainers = [ ];
  };
}
+6 −0
Original line number Diff line number Diff line
@@ -2586,6 +2586,8 @@ self: super: with self; {
  compressed-rtf = callPackage ../development/python-modules/compressed-rtf { };
  compressed-tensors = callPackage ../development/python-modules/compressed-tensors { };
  concurrent-log-handler = callPackage ../development/python-modules/concurrent-log-handler { };
  conda = callPackage ../development/python-modules/conda { };
@@ -8276,6 +8278,8 @@ self: super: with self; {
  mistletoe = callPackage ../development/python-modules/mistletoe { };
  mistral-common = callPackage ../development/python-modules/mistral-common { };
  mistune = callPackage ../development/python-modules/mistune { };
  mitmproxy = callPackage ../development/python-modules/mitmproxy { };
@@ -10088,6 +10092,8 @@ self: super: with self; {
  partd = callPackage ../development/python-modules/partd { };
  partial-json-parser = callPackage ../development/python-modules/partial-json-parser { };
  parts = callPackage ../development/python-modules/parts { };
  particle = callPackage ../development/python-modules/particle { };