Tags: instructlab/instructlab
Tags
fix: properly gate usage of torch.cuda.device_count (backport #3358) (#… …3359) since we support HPU and ROCm for inference, we need to gate torch.cuda.device_count since on HPU specificially this will cause issues. use similar logic as we do in `init.py` to ensure CUDA is available, and HPU/ROCm are not. **Checklist:** - [x] **Commit Message Formatting**: Commit titles and messages follow guidelines in the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary). - [ ] [Changelog](https://github.com/instructlab/instructlab/blob/main/CHANGELOG.md) updated with breaking and/or notable changes for the next minor release. - [ ] Documentation has been updated, if necessary. - [ ] Unit tests have been added, if necessary. - [ ] Functional tests have been added, if necessary. - [ ] E2E Workflow tests have been added, if necessary. <hr>This is an automatic backport of pull request #3358 done by [Mergify](https://mergify.com). Approved-by: booxter Approved-by: cdoern
cap upper versions for instructlab 0.26 release series (#3335) Bump the minimum version of SDG to [0.8.2](https://github.com/instructlab/sdg/releases/tag/v0.8.2) for the features and fixes in that library. Constrain the upper version bounds for the three main instructlab libraries for our core 0.26 release series. Approved-by: cdoern Approved-by: courtneypacheco
fix: ilab taxonomy diff provides full error details when it fails (ba… …ckport #3220) (#3223) In this change, ilab taxonomy diff provides the full error details when it fails instead of just the error message, which is often missing or lacking crucial detail. In one motivating example, we see the before output as: ``` Reading taxonomy failed with the following error: ``` and the after output as: ``` Reading taxonomy failed with the following error: ] Traceback (most recent call last): File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/instructlab/schema/taxonomy.py", line 403, in parse contents: Mapping[str, typing.Any] | typing.Any = yaml.safe_load(text) ^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/__init__.py", line 125, in safe_load return load(stream, SafeLoader) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/__init__.py", line 81, in load return loader.get_single_data() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/constructor.py", line 49, in get_single_data node = self.get_single_node() ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(None, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 82, in compose_node node = self.compose_sequence_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 111, in compose_sequence_node node.value.append(self.compose_node(node, index)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 82, in compose_node node = self.compose_sequence_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 111, in compose_sequence_node node.value.append(self.compose_node(node, index)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 127, in compose_mapping_node while not self.check_event(MappingEndEvent): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/parser.py", line 98, in check_event self.current_event = self.state() ^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key if self.check_token(KeyToken): ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/scanner.py", line 115, in check_token while self.need_more_tokens(): ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/scanner.py", line 152, in need_more_tokens self.stale_possible_simple_keys() File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/scanner.py", line 291, in stale_possible_simple_keys raise ScannerError("while scanning a simple key", key.mark, yaml.scanner.ScannerError: while scanning a simple key in "<unicode string>", line 62, column 9: merchandise, and VIP treatment a ... ^ could not find expected ':' in "<unicode string>", line 63, column 3: - context: | ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/bmurdock/git/ilab-taxo-diff/instructlab/src/instructlab/taxonomy/diff.py", line 88, in diff validate_taxonomy(taxonomy_path, taxonomy_base, yaml_rules) File "/Users/bmurdock/git/ilab-taxo-diff/instructlab/src/instructlab/utils.py", line 456, in validate_taxonomy warnings, errors = validate_taxonomy_file(file_path, yamllint_config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/git/ilab-taxo-diff/instructlab/src/instructlab/utils.py", line 396, in validate_taxonomy_file taxonomy = parser.parse(file_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/instructlab/schema/taxonomy.py", line 432, in parse raise TaxonomyReadingException from e instructlab.schema.taxonomy.TaxonomyReadingException ``` As you can see, the after behavior is messy but does tell you what when wrong and what line and character it went wrong at. **Checklist:** - [x] **Commit Message Formatting**: Commit titles and messages follow guidelines in the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary). - [ ] [Changelog](https://github.com/instructlab/instructlab/blob/main/CHANGELOG.md) updated with breaking and/or notable changes for the next minor release. - [ ] Documentation has been updated, if necessary. - [ ] Unit tests have been added, if necessary. - [ ] Functional tests have been added, if necessary. - [ ] E2E Workflow tests have been added, if necessary. <hr>This is an automatic backport of pull request #3220 done by [Mergify](https://mergify.com). Approved-by: nathan-weinberg Approved-by: courtneypacheco
fix: ilab taxonomy diff provides full error details when it fails (ba… …ckport #3220) (#3221) In this change, ilab taxonomy diff provides the full error details when it fails instead of just the error message, which is often missing or lacking crucial detail. In one motivating example, we see the before output as: ``` Reading taxonomy failed with the following error: ``` and the after output as: ``` Reading taxonomy failed with the following error: ] Traceback (most recent call last): File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/instructlab/schema/taxonomy.py", line 403, in parse contents: Mapping[str, typing.Any] | typing.Any = yaml.safe_load(text) ^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/__init__.py", line 125, in safe_load return load(stream, SafeLoader) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/__init__.py", line 81, in load return loader.get_single_data() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/constructor.py", line 49, in get_single_data node = self.get_single_node() ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(None, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 82, in compose_node node = self.compose_sequence_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 111, in compose_sequence_node node.value.append(self.compose_node(node, index)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 82, in compose_node node = self.compose_sequence_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 111, in compose_sequence_node node.value.append(self.compose_node(node, index)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/composer.py", line 127, in compose_mapping_node while not self.check_event(MappingEndEvent): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/parser.py", line 98, in check_event self.current_event = self.state() ^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key if self.check_token(KeyToken): ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/scanner.py", line 115, in check_token while self.need_more_tokens(): ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/scanner.py", line 152, in need_more_tokens self.stale_possible_simple_keys() File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/yaml/scanner.py", line 291, in stale_possible_simple_keys raise ScannerError("while scanning a simple key", key.mark, yaml.scanner.ScannerError: while scanning a simple key in "<unicode string>", line 62, column 9: merchandise, and VIP treatment a ... ^ could not find expected ':' in "<unicode string>", line 63, column 3: - context: | ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/bmurdock/git/ilab-taxo-diff/instructlab/src/instructlab/taxonomy/diff.py", line 88, in diff validate_taxonomy(taxonomy_path, taxonomy_base, yaml_rules) File "/Users/bmurdock/git/ilab-taxo-diff/instructlab/src/instructlab/utils.py", line 456, in validate_taxonomy warnings, errors = validate_taxonomy_file(file_path, yamllint_config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/git/ilab-taxo-diff/instructlab/src/instructlab/utils.py", line 396, in validate_taxonomy_file taxonomy = parser.parse(file_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/bmurdock/.pyenv/versions/bmurdock-pyenv-virtualenv/lib/python3.11/site-packages/instructlab/schema/taxonomy.py", line 432, in parse raise TaxonomyReadingException from e instructlab.schema.taxonomy.TaxonomyReadingException ``` As you can see, the after behavior is messy but does tell you what when wrong and what line and character it went wrong at. **Checklist:** - [x] **Commit Message Formatting**: Commit titles and messages follow guidelines in the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary). - [ ] [Changelog](https://github.com/instructlab/instructlab/blob/main/CHANGELOG.md) updated with breaking and/or notable changes for the next minor release. - [ ] Documentation has been updated, if necessary. - [ ] Unit tests have been added, if necessary. - [ ] Functional tests have been added, if necessary. - [ ] E2E Workflow tests have been added, if necessary. <hr>This is an automatic backport of pull request #3220 done by [Mergify](https://mergify.com). Approved-by: nathan-weinberg Approved-by: courtneypacheco
Make SDG batch size configurable via system profile (backport #3157) (#… …3207) Currently, the batch size for SDG is only configurable via the CLI, but a single batch size across all hardware profiles is not optimal. Different hardware configurations have varying capabilities, and using a fixed batch size can lead to under-utilization or over-utilization of resources during the SDG process. To ensure efficient performance across different hardware, we should set the batch sizes independently in each system profile. <hr>This is an automatic backport of pull request #3157 done by [Mergify](https://mergify.com). Approved-by: courtneypacheco Approved-by: ktdreyer
PreviousNext