Skip to content

Commit

Permalink
Merge branch 'main' into migrate-existing-logger-framework
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-tuli committed Oct 15, 2023
2 parents 6c5f293 + 1a2bddf commit bdd9939
Show file tree
Hide file tree
Showing 24 changed files with 114 additions and 451 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
Expand All @@ -86,7 +86,7 @@ jobs:
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
Expand All @@ -110,7 +110,7 @@ jobs:
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
Expand All @@ -134,7 +134,7 @@ jobs:
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

# Developing SparseML

SparseML is developed and tested using Python 3.8-3.10.
SparseML is developed and tested using Python 3.8-3.11.
To develop SparseML, you will also need the development dependencies and to follow the styling guidelines.

Here are some details to get started.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ SparseML enables you to create a sparse model trained on your dataset in two way

## Installation

This repository is tested on Python 3.8-3.10, and Linux/Debian systems.
This repository is tested on Python 3.8-3.11, and Linux/Debian systems.

It is recommended to install in a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your system in order.
Currently supported ML Frameworks are the following: `torch>=1.1.0,<=2.0`, `tensorflow>=1.8.0,<2.0.0`, `tensorflow.keras >= 2.2.0`.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

# Installation

This repository is tested on Python 3.8-3.10, and Linux/Debian systems.
This repository is tested on Python 3.8-3.11, and Linux/Debian systems.
It is recommended to install in a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your system in order.
Currently supported ML Frameworks are the following: `torch>=1.1.0,<1.14`, `tensorflow>=1.8.0,<=2.0.0`, `tensorflow.keras >= 2.2.0`.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _setup_long_description() -> Tuple[str, str]:
install_requires=_setup_install_requires(),
extras_require=_setup_extras(),
entry_points=_setup_entry_points(),
python_requires=">=3.8.0,<3.11",
python_requires=">=3.8.0,<3.12",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
Expand Down
2 changes: 1 addition & 1 deletion src/sparseml/core/lifecycle/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@dataclass
class SparsificationLifecycle:
state: Optional[State] = None
recipe_container: RecipeContainer = RecipeContainer()
recipe_container: RecipeContainer = field(default_factory=RecipeContainer)
modifiers: List[ModifierInterface] = field(default_factory=list)
event_lifecycle: Optional[EventLifecycle] = None

Expand Down
13 changes: 0 additions & 13 deletions src/sparseml/experimental/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions src/sparseml/experimental/sparsegpt/__init__.py

This file was deleted.

10 changes: 5 additions & 5 deletions src/sparseml/experimental/sparsegpt/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

SUPPORTED_MODELS = ["opt", "mpt", "llama"]
SUPPORTED_MODELS = ["opt", "mpt", "llama-2"]


def load_model(args, model_key: str = None, *gargs, **kwargs):
Expand All @@ -21,7 +21,7 @@ def load_model(args, model_key: str = None, *gargs, **kwargs):
from sparseml.experimental.sparsegpt.opt import load_model as _load_model
elif model_key == "mpt":
from sparseml.experimental.sparsegpt.mpt import load_model as _load_model
elif model_key == "llama":
elif model_key == "llama-2":
from sparseml.experimental.sparsegpt.llama2 import load_model as _load_model
else:
raise ValueError(f"Unrecognized model key. Supported: {SUPPORTED_MODELS}")
Expand All @@ -34,7 +34,7 @@ def load_data(args, model_key: str = None, *gargs, **kwargs):
from sparseml.experimental.sparsegpt.opt import load_data as _load_data
elif model_key == "mpt":
from sparseml.experimental.sparsegpt.mpt import load_data as _load_data
elif model_key == "llama":
elif model_key == "llama-2":
from sparseml.experimental.sparsegpt.llama2 import load_data as _load_data
else:
raise ValueError(f"Unrecognized model key. Supported: {SUPPORTED_MODELS}")
Expand All @@ -47,7 +47,7 @@ def evaluate_perplexity(
model_key = _get_model_key(args) if model_key is None else model_key
if model_key == "opt":
from sparseml.experimental.sparsegpt.opt import ppl_eval as _ppl_eval
elif model_key == "llama":
elif model_key == "llama-2":
from sparseml.experimental.sparsegpt.llama2 import ppl_eval as _ppl_eval
else:
raise ValueError(f"Unrecognized model key. Supported: {SUPPORTED_MODELS}")
Expand All @@ -64,7 +64,7 @@ def prepare_sparsegpt(model, dataloader, args, model_key: str = None, **kwargs):
from sparseml.experimental.sparsegpt.mpt import (
prepare_sparsegpt as _prepare_sparsegpt,
)
elif model_key == "llama":
elif model_key == "llama-2":
from sparseml.experimental.sparsegpt.llama2 import (
prepare_sparsegpt as _prepare_sparsegpt,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

dataset = "open_platypus"
model_name = "/home/sadkins/ml-experiments/nlg-text_generation/"
model_name += "llama_chat-llama_7b_chat-base/dense/training"
model_name += "llama_chat-llama_7b_chat-base/dense_llama-2/training"
sparsity = 0.5
nbits = 8
smooth_quant = 0
Expand Down Expand Up @@ -73,7 +73,7 @@ class ProdArgs:


def run_experimental_obcq(experimental_args):
model = load_model(experimental_args)
model, _ = load_model(experimental_args)
calibration_data, _, _ = load_data(experimental_args, data_sequence_length)
sequential(model, calibration_data, device, experimental_args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ProdArgs:


def run_experimental_obcq(experimental_args):
model = load_model(experimental_args)
model, _ = load_model(experimental_args)
calibration_data, _, _ = load_data(experimental_args, data_sequence_length)
sequential(model, calibration_data, device, experimental_args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

export CUDA_VISIBLE_DEVICES=0

ROOT=$HOME/sparseml/src/sparseml/experimental/sparsegpt
ROOT=$HOME/src/neuralmagic/sparseml/src/sparseml/experimental/sparsegpt

DATASET=c4

RECIPE_DIR=$ROOT/examples/opt/recipes
RECIPE_DIR=$ROOT/recipes
RECIPE_NAME=opt-1.3b-opt_pretrain-pruned50_quantW8A8

SRC_MODEL_ORG=facebook
Expand Down
3 changes: 0 additions & 3 deletions src/sparseml/experimental/sparsegpt/layer_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
from sparseml.experimental.sparsegpt.sparsegpt import SparseGPT


DEFAULT_WBITS = 16


class BaseCompressor:
def __init__(self, model):
self.model = model
Expand Down
Loading

0 comments on commit bdd9939

Please sign in to comment.