Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: caikit/caikit-nlp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5.9
Choose a base ref
...
head repository: caikit/caikit-nlp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.5.10
Choose a head ref
  • 6 commits
  • 10 files changed
  • 2 contributors

Commits on Feb 14, 2025

  1. :packages: Update torch, transformers, peft and accelerate libs

    Signed-off-by: gkumbhat <kumbhat.gaurav@gmail.com>
    gkumbhat committed Feb 14, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    56decdb View commit details

Commits on Feb 17, 2025

  1. 📦 Update packages and fix failing tests

    Signed-off-by: gkumbhat <kumbhat.gaurav@gmail.com>
    gkumbhat committed Feb 17, 2025
    Copy the full SHA
    c1d1c57 View commit details
  2. 🛂 Update owners to reflect active working members

    Signed-off-by: gkumbhat <kumbhat.gaurav@gmail.com>
    gkumbhat committed Feb 17, 2025
    Copy the full SHA
    3513e34 View commit details
  3. 🔥 Remove print and de-duplicate test name

    Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
    evaline-ju committed Feb 17, 2025
    Copy the full SHA
    302bb87 View commit details

Commits on Feb 18, 2025

  1. 🐛 Fix remote tgis execution config

    Signed-off-by: gkumbhat <kumbhat.gaurav@gmail.com>
    gkumbhat committed Feb 18, 2025
    Copy the full SHA
    6cd31ed View commit details
  2. Merge pull request #411 from gkumbhat/update_packages_feb_14

    📦 Dependency updates
    gkumbhat authored Feb 18, 2025
    Copy the full SHA
    69f99cb View commit details
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@
# https://help.github.com/en/articles/about-code-owners
#

* @alex-jw-brooks @gkumbhat @evaline-ju @gabe-l-hart @tharapalanivel @Ssukriti
* @gkumbhat @evaline-ju @gabe-l-hart
8 changes: 6 additions & 2 deletions caikit_nlp/modules/text_embedding/crossencoder.py
Original file line number Diff line number Diff line change
@@ -431,8 +431,10 @@ def __init__(
num_labels: int = None,
max_length: int = None,
device: str = None,
tokenizer_args: Dict = None,
automodel_args: Dict = None,
tokenizer_args: Dict = None,
config_args: Dict = None,
cache_dir: str = None,
trust_remote_code: bool = False,
revision: Optional[str] = None,
local_files_only: bool = False,
@@ -444,8 +446,10 @@ def __init__(
num_labels,
max_length,
device,
tokenizer_args,
automodel_args,
tokenizer_args,
config_args,
cache_dir,
trust_remote_code,
revision,
local_files_only,
4 changes: 4 additions & 0 deletions caikit_nlp/modules/text_generation/text_generation_local.py
Original file line number Diff line number Diff line change
@@ -641,6 +641,10 @@ def _launch_training(
) -> None:
"""Utility function to wrap trainer and execute training"""

# gradient_accumulation_steps seems to be causing hang atleast on CPU training
# so we are removing it for now here
del training_args["gradient_accumulation_steps"]

trainer = base_model.get_trainer(
train_dataset=training_dataset, **training_args
)
5 changes: 4 additions & 1 deletion caikit_nlp/resources/pretrained_model/base.py
Original file line number Diff line number Diff line change
@@ -48,7 +48,8 @@


class LoggingTrainer(Trainer):
def log(self, logs: Dict[str, float]) -> None:
# pylint: disable=unused-argument
def log(self, logs: Dict[str, float], start_time: Optional[float] = None) -> None:
"""
Log `logs` on the various objects watching training.
@@ -58,6 +59,8 @@ def log(self, logs: Dict[str, float]) -> None:
logs (`Dict[str, float]`):
The values to log.
"""
# start_time was added in default trainer log
# https://github.com/huggingface/transformers/pull/34507
self.state = log_step(self.state, logs)
self.control = self.callback_handler.on_log(
self.args, self.state, self.control, logs
7 changes: 5 additions & 2 deletions caikit_nlp/resources/pretrained_model/hf_auto_seq2seq_lm.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
"""
# Standard
from collections.abc import Mapping
from typing import Dict, List, Union
from typing import Dict, List, Optional, Union

# Third Party
from torch.utils.data import IterableDataset
@@ -46,7 +46,8 @@


class LoggingTrainer(Seq2SeqTrainer):
def log(self, logs: Dict[str, float]) -> None:
# pylint: disable=unused-argument
def log(self, logs: Dict[str, float], start_time: Optional[float] = None) -> None:
"""
Log `logs` on the various objects watching training.
@@ -56,6 +57,8 @@ def log(self, logs: Dict[str, float]) -> None:
logs (`Dict[str, float]`):
The values to log.
"""
# start_time was added in default trainer log
# https://github.com/huggingface/transformers/pull/34507
self.state = log_step(self.state, logs)
self.control = self.callback_handler.on_log(
self.args, self.state, self.control, logs
11 changes: 10 additions & 1 deletion examples/utils.py
Original file line number Diff line number Diff line change
@@ -88,7 +88,16 @@ def get_distributed_model(model_path):
"initializers": {
"default": {
"config": {
"backend_priority": [{"type": TGISBackend.backend_type}]
"backend_priority": [
{
"type": TGISBackend.backend_type,
"config": {
"connection": {
"hostname": "localhost:8033",
}
},
}
]
}
}
}
23 changes: 12 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -20,19 +20,20 @@ dependencies = [
"grpcio>=1.62.2", # explicitly pin grpc dependencies to a recent version to avoid pip backtracking
"grpcio-reflection>=1.62.2",
"grpcio-health-checking>=1.62.2",
"accelerate>=0.22.0",
"datasets>=2.4.0",
"accelerate>=1.3.0",
"datasets>=3.3.0",
"huggingface-hub",
"numpy>=1.22.4",
"pandas>=1.5.0",
"scikit-learn>=1.1",
"scipy>=1.8.1",
"sentence-transformers>=3.0.0,<3.1.0",
"tokenizers>=0.13.3",
"numpy>=1.23.0",
"pandas>=2.2.3",
"scikit-learn>=1.6.1",
"scipy>=1.10.0",
"sentence-transformers>=3.4.0,<3.5.0",
"tf-keras>=2.18.0",
"tokenizers>=0.20.0",
"torch>=2.3.1,<2.6.0",
"tqdm>=4.65.0",
"transformers>=4.38.0,<4.44.0",
"peft==0.6.0",
"tqdm>=4.67.0",
"transformers>=4.48.3,<4.50.0",
"peft==0.14.0",
]

[tool.setuptools.packages.find]
1 change: 0 additions & 1 deletion tests/modules/text_embedding/test_crossencoder.py
Original file line number Diff line number Diff line change
@@ -507,7 +507,6 @@ def test_truncation(truncate_input_tokens, loaded_model):
queries_scores = [x.score for x in r.scores]
query_scores = [x.score for x in query_results[i].scores]
assert np.array_equal(queries_scores, query_scores)

# To compare scores based on the inputs, we need to use the index too
indexed_query_scores = {s.index: s.score for s in query_results[i].scores}

1 change: 0 additions & 1 deletion tests/modules/text_generation/test_peft_prompt_tuning.py
Original file line number Diff line number Diff line change
@@ -89,7 +89,6 @@ def test_run_stream_out_model(causal_lm_dummy_model):
pred_stream = causal_lm_dummy_model.run_stream_out("This text doesn't matter")
assert isinstance(pred_stream, Iterable)
for pred in pred_stream:
print(pred)
assert isinstance(pred, GeneratedTextStreamResult)


Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ def test_train_model_causallm(disable_wip, set_cpu_device):


@pytest.mark.skipif(platform.processor() == "arm", reason="ARM training not supported")
def test_train_model_causallm(disable_wip, set_cpu_device):
def test_train_and_infer_model_causallm(disable_wip, set_cpu_device):
"""Ensure that we can finetune a causal-lm model on some toy data for 1+
steps & run inference."""
train_kwargs = {