Granite Library
Safetensors
GGUF
English
kndtran commited on
Commit
7ba0147
·
1 Parent(s): 46b6691

chore: change yaml output without sorted keys, preserving original ordering

Browse files
_ollama/convert_io_yaml_files.py CHANGED
@@ -24,7 +24,7 @@ def find_all_model_paths(model_name: str) -> List[Path]:
24
  paths = []
25
  for p in current.rglob(model_name):
26
  rp = p.relative_to(current).parts
27
- if p.is_dir() and not (rp[0].startswith("_") or rp[0].startswith("_")):
28
  paths.append(p)
29
  return sorted(paths)
30
 
@@ -62,7 +62,7 @@ def convert_io_yaml_hf_to_ollama(hf_path: Path, ollama_path: Path):
62
  del ollama_yaml["parameters"]["max_completion_tokens"]
63
 
64
  with ollama_path.open("w") as f:
65
- yaml.dump(ollama_yaml, f, default_style=False)
66
 
67
  def convert_lora_adapters(model_name: str, model_paths: List[Path]):
68
  """Converts LoRA adapters into GGUF format.
 
24
  paths = []
25
  for p in current.rglob(model_name):
26
  rp = p.relative_to(current).parts
27
+ if p.is_dir() and not (rp[0].startswith(".") or rp[0].startswith("_")):
28
  paths.append(p)
29
  return sorted(paths)
30
 
 
62
  del ollama_yaml["parameters"]["max_completion_tokens"]
63
 
64
  with ollama_path.open("w") as f:
65
+ yaml.dump(ollama_yaml, f, default_style=False, sort_keys=False)
66
 
67
  def convert_lora_adapters(model_name: str, model_paths: List[Path]):
68
  """Converts LoRA adapters into GGUF format.
answer_relevance_classifier/granite4_micro/lora/io.yaml CHANGED
@@ -1,14 +1,28 @@
1
- docs_as_message: roles
2
- instruction: answer_relevance
3
  model: null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  parameters:
5
- max_tokens: 1024
6
  response_format:
7
  properties:
8
  answer_relevance_analysis:
9
  title: Answer Relevance Analysis
10
  type: string
11
  answer_relevance_category:
 
 
12
  enum:
13
  - Pertinent
14
  - Pertinent with relevant extra
@@ -18,8 +32,6 @@ parameters:
18
  - Contextual misalignment
19
  - Misinterpreted inquiry
20
  - No attempt
21
- title: Answer Relevance Category
22
- type: string
23
  answer_relevance_judgment:
24
  title: Answer Relevance Judgment
25
  type: boolean
@@ -29,18 +41,6 @@ parameters:
29
  - answer_relevance_judgment
30
  title: AnswerRelevanceRawOutput
31
  type: object
32
- response_format: null
33
  sentence_boundaries: null
34
- transformations:
35
- - categories_to_values:
36
- false: 0.0
37
- true: 1.0
38
- input_path:
39
- - answer_relevance_judgment
40
- type: likelihood
41
- - input_path: []
42
- retained_fields:
43
- answer_relevance_analysis: answer_relevance_analysis
44
- answer_relevance_category: answer_relevance_category
45
- answer_relevance_judgment: answer_relevance_likelihood
46
- type: project
 
 
 
1
  model: null
2
+ response_format: null
3
+ instruction: answer_relevance
4
+ transformations:
5
+ - type: likelihood
6
+ categories_to_values:
7
+ true: 1.0
8
+ false: 0.0
9
+ input_path:
10
+ - answer_relevance_judgment
11
+ - type: project
12
+ input_path: []
13
+ retained_fields:
14
+ answer_relevance_analysis: answer_relevance_analysis
15
+ answer_relevance_category: answer_relevance_category
16
+ answer_relevance_judgment: answer_relevance_likelihood
17
  parameters:
 
18
  response_format:
19
  properties:
20
  answer_relevance_analysis:
21
  title: Answer Relevance Analysis
22
  type: string
23
  answer_relevance_category:
24
+ title: Answer Relevance Category
25
+ type: string
26
  enum:
27
  - Pertinent
28
  - Pertinent with relevant extra
 
32
  - Contextual misalignment
33
  - Misinterpreted inquiry
34
  - No attempt
 
 
35
  answer_relevance_judgment:
36
  title: Answer Relevance Judgment
37
  type: boolean
 
41
  - answer_relevance_judgment
42
  title: AnswerRelevanceRawOutput
43
  type: object
44
+ max_tokens: 1024
45
  sentence_boundaries: null
46
+ docs_as_message: roles
 
 
 
 
 
 
 
 
 
 
 
 
answer_relevance_rewriter/granite4_micro/lora/io.yaml CHANGED
@@ -1,4 +1,5 @@
1
- docs_as_message: roles
 
2
  instruction: "Rewrite the response for relevance.\nThe last assistant response is\
3
  \ considered not fully relevant to the last user inquiry due to {answer_relevance_category}:\
4
  \ {answer_relevance_analysis}\nDecide if you agree with this assessment, then act\
@@ -12,9 +13,8 @@ instruction: "Rewrite the response for relevance.\nThe last assistant response i
12
  \ regarding the original response, its assessment, or this instruction. The user\
13
  \ does not see any of these. Your response is the only response they will see to\
14
  \ their inquiry, in place of the original response.\n"
15
- model: null
16
  parameters:
17
- max_tokens: 1024
18
  response_format:
19
  properties:
20
  answer_relevance_rewrite:
@@ -23,6 +23,6 @@ parameters:
23
  required:
24
  - answer_relevance_rewrite
25
  type: object
26
- response_format: null
27
  sentence_boundaries: null
28
- transformations: null
 
1
+ model: null
2
+ response_format: null
3
  instruction: "Rewrite the response for relevance.\nThe last assistant response is\
4
  \ considered not fully relevant to the last user inquiry due to {answer_relevance_category}:\
5
  \ {answer_relevance_analysis}\nDecide if you agree with this assessment, then act\
 
13
  \ regarding the original response, its assessment, or this instruction. The user\
14
  \ does not see any of these. Your response is the only response they will see to\
15
  \ their inquiry, in place of the original response.\n"
16
+ transformations: null
17
  parameters:
 
18
  response_format:
19
  properties:
20
  answer_relevance_rewrite:
 
23
  required:
24
  - answer_relevance_rewrite
25
  type: object
26
+ max_tokens: 1024
27
  sentence_boundaries: null
28
+ docs_as_message: roles
answerability/granite4_micro/alora/io.yaml CHANGED
@@ -1,21 +1,21 @@
1
- docs_as_message: roles
2
- instruction: null
3
  model: null
4
- parameters:
5
- max_tokens: 6
6
- response_format:
7
- enum:
8
- - answerable
9
- - unanswerable
10
- type: string
11
  response_format: null
12
- sentence_boundaries: null
13
  transformations:
14
- - categories_to_values:
 
15
  answerable: 1.0
16
  unanswerable: 0.0
17
  input_path: []
18
- type: likelihood
19
- - field_name: answerability_likelihood
20
  input_path: []
21
- type: nest
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  model: null
 
 
 
 
 
 
 
2
  response_format: null
 
3
  transformations:
4
+ - type: likelihood
5
+ categories_to_values:
6
  answerable: 1.0
7
  unanswerable: 0.0
8
  input_path: []
9
+ - type: nest
 
10
  input_path: []
11
+ field_name: answerability_likelihood
12
+ instruction: null
13
+ parameters:
14
+ response_format:
15
+ type: string
16
+ enum:
17
+ - answerable
18
+ - unanswerable
19
+ max_tokens: 6
20
+ sentence_boundaries: null
21
+ docs_as_message: roles
answerability/granite4_micro/lora/io.yaml CHANGED
@@ -1,21 +1,21 @@
1
- docs_as_message: roles
2
- instruction: null
3
  model: null
4
- parameters:
5
- max_tokens: 6
6
- response_format:
7
- enum:
8
- - answerable
9
- - unanswerable
10
- type: string
11
  response_format: null
12
- sentence_boundaries: null
13
  transformations:
14
- - categories_to_values:
 
15
  answerable: 1.0
16
  unanswerable: 0.0
17
  input_path: []
18
- type: likelihood
19
- - field_name: answerability_likelihood
20
  input_path: []
21
- type: nest
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  model: null
 
 
 
 
 
 
 
2
  response_format: null
 
3
  transformations:
4
+ - type: likelihood
5
+ categories_to_values:
6
  answerable: 1.0
7
  unanswerable: 0.0
8
  input_path: []
9
+ - type: nest
 
10
  input_path: []
11
+ field_name: answerability_likelihood
12
+ instruction: null
13
+ parameters:
14
+ response_format:
15
+ type: string
16
+ enum:
17
+ - answerable
18
+ - unanswerable
19
+ max_tokens: 6
20
+ sentence_boundaries: null
21
+ docs_as_message: roles
citations/granite4_micro/lora/io.yaml CHANGED
@@ -1,70 +1,35 @@
1
- docs_as_message: roles
2
- instruction: 'Split the last assistant response into individual sentences. For each
3
- sentence in the response, identify the statement IDs from the below documents that
4
- it references. Ensure that your output includes all response sentence IDs, and
5
- for each response sentence ID, provide the list of corresponding referring document
6
- sentence IDs. The output must be a json structure.
7
-
8
- '
9
  model: null
10
- parameters:
11
- max_tokens: 4096
12
- response_format:
13
- $defs:
14
- _MODEL_OUTPUT_ENTRY:
15
- properties:
16
- c:
17
- items:
18
- minimum: 0
19
- type: integer
20
- title: C
21
- type: array
22
- r:
23
- minimum: 0
24
- title: R
25
- type: integer
26
- required:
27
- - r
28
- - c
29
- title: _MODEL_OUTPUT_ENTRY
30
- type: object
31
- items:
32
- $ref: '#/$defs/_MODEL_OUTPUT_ENTRY'
33
- title: _MODEL_OUTPUT
34
- type: array
35
  response_format: null
36
- sentence_boundaries:
37
- documents: c
38
- last_message: r
39
  transformations:
40
- - input_path: []
 
41
  target_field: c
42
- type: explode
43
- - input_path: []
44
  target_fields:
45
  - r
46
  - c
47
- type: drop_duplicates
48
- - input_path:
 
49
  - null
50
  - r
51
  output_names:
52
  begin: response_begin
53
  end: response_end
54
  text: response_text
55
- source: last_message
56
- type: decode_sentences
57
- - input_path:
58
  - null
59
  - c
60
  output_names:
61
- begin: citation_begin
62
  document_id: citation_doc_id
 
63
  end: citation_end
64
  text: citation_text
65
- source: documents
66
- type: decode_sentences
67
- - input_path: []
68
  retained_fields:
69
  - response_begin
70
  - response_end
@@ -73,14 +38,49 @@ transformations:
73
  - citation_begin
74
  - citation_end
75
  - citation_text
76
- type: project
77
- - begin_field: citation_begin
78
- end_field: citation_end
79
  group_fields:
80
  - response_begin
81
  - response_end
82
  - response_text
83
  - citation_doc_id
84
- input_path: []
 
85
  text_field: citation_text
86
- type: merge_spans
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  model: null
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  response_format: null
 
 
 
3
  transformations:
4
+ - type: explode
5
+ input_path: []
6
  target_field: c
7
+ - type: drop_duplicates
8
+ input_path: []
9
  target_fields:
10
  - r
11
  - c
12
+ - type: decode_sentences
13
+ source: last_message
14
+ input_path:
15
  - null
16
  - r
17
  output_names:
18
  begin: response_begin
19
  end: response_end
20
  text: response_text
21
+ - type: decode_sentences
22
+ source: documents
23
+ input_path:
24
  - null
25
  - c
26
  output_names:
 
27
  document_id: citation_doc_id
28
+ begin: citation_begin
29
  end: citation_end
30
  text: citation_text
31
+ - type: project
32
+ input_path: []
 
33
  retained_fields:
34
  - response_begin
35
  - response_end
 
38
  - citation_begin
39
  - citation_end
40
  - citation_text
41
+ - type: merge_spans
42
+ input_path: []
 
43
  group_fields:
44
  - response_begin
45
  - response_end
46
  - response_text
47
  - citation_doc_id
48
+ begin_field: citation_begin
49
+ end_field: citation_end
50
  text_field: citation_text
51
+ instruction: 'Split the last assistant response into individual sentences. For each
52
+ sentence in the response, identify the statement IDs from the below documents that
53
+ it references. Ensure that your output includes all response sentence IDs, and
54
+ for each response sentence ID, provide the list of corresponding referring document
55
+ sentence IDs. The output must be a json structure.
56
+
57
+ '
58
+ parameters:
59
+ response_format:
60
+ $defs:
61
+ _MODEL_OUTPUT_ENTRY:
62
+ properties:
63
+ r:
64
+ minimum: 0
65
+ title: R
66
+ type: integer
67
+ c:
68
+ items:
69
+ minimum: 0
70
+ type: integer
71
+ title: C
72
+ type: array
73
+ required:
74
+ - r
75
+ - c
76
+ title: _MODEL_OUTPUT_ENTRY
77
+ type: object
78
+ items:
79
+ $ref: '#/$defs/_MODEL_OUTPUT_ENTRY'
80
+ title: _MODEL_OUTPUT
81
+ type: array
82
+ max_tokens: 4096
83
+ sentence_boundaries:
84
+ last_message: r
85
+ documents: c
86
+ docs_as_message: roles
context_relevance/granite4_micro/lora/io.yaml CHANGED
@@ -1,29 +1,29 @@
1
- docs_as_message: roles
 
2
  instruction: 'DOCUMENT: {document_content}
3
 
4
  '
5
- model: null
 
 
 
 
 
 
 
6
  parameters:
7
  response_format:
 
 
8
  properties:
9
  context_relevance:
 
10
  description: Context relevancy judgment.
11
  enum:
12
  - relevant
13
  - irrelevant
14
  - partially relevant
15
- type: string
16
  required:
17
  - context_relevance
18
- title: ContextRelevanceOutput
19
- type: object
20
- response_format: null
21
  sentence_boundaries: null
22
- transformations:
23
- - categories_to_values:
24
- irrelevant: 0.0
25
- partially relevant: 0.5
26
- relevant: 1.0
27
- input_path:
28
- - context_relevance
29
- type: likelihood
 
1
+ model: null
2
+ response_format: null
3
  instruction: 'DOCUMENT: {document_content}
4
 
5
  '
6
+ transformations:
7
+ - type: likelihood
8
+ categories_to_values:
9
+ relevant: 1.0
10
+ irrelevant: 0.0
11
+ partially relevant: 0.5
12
+ input_path:
13
+ - context_relevance
14
  parameters:
15
  response_format:
16
+ title: ContextRelevanceOutput
17
+ type: object
18
  properties:
19
  context_relevance:
20
+ type: string
21
  description: Context relevancy judgment.
22
  enum:
23
  - relevant
24
  - irrelevant
25
  - partially relevant
 
26
  required:
27
  - context_relevance
 
 
 
28
  sentence_boundaries: null
29
+ docs_as_message: roles
 
 
 
 
 
 
 
hallucination_detection/granite4_micro/lora/io.yaml CHANGED
@@ -1,4 +1,31 @@
1
- docs_as_message: roles
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  instruction: 'Split the last assistant response into individual sentences. For each
3
  sentence in the last assistant response, identify the faithfulness by comparing
4
  with the provided documents and generate the faithfulness reasoning and faithfulness
@@ -7,27 +34,25 @@ instruction: 'Split the last assistant response into individual sentences. For e
7
  decision. The output must be a json structure.
8
 
9
  '
10
- model: null
11
  parameters:
12
- max_tokens: 4096
13
  response_format:
14
  $defs:
15
  HallucinationOutputEntry:
16
  properties:
17
- e:
18
- title: Reasoning
19
- type: string
 
20
  f:
 
 
21
  enum:
22
  - faithful
23
  - partial
24
  - unfaithful
25
- title: Is Faithful
 
26
  type: string
27
- r:
28
- minimum: 0
29
- title: Sentence Num
30
- type: integer
31
  required:
32
  - r
33
  - e
@@ -38,32 +63,7 @@ parameters:
38
  $ref: '#/$defs/HallucinationOutputEntry'
39
  title: HallucinationOutput
40
  type: array
41
- response_format: null
42
  sentence_boundaries:
43
  last_message: i
44
- transformations:
45
- - categories_to_values:
46
- faithful: 1.0
47
- partial: 0.5
48
- unfaithful: 0.0
49
- input_path:
50
- - null
51
- - f
52
- type: likelihood
53
- - input_path:
54
- - null
55
- - r
56
- output_names:
57
- begin: response_begin
58
- end: response_end
59
- text: response_text
60
- source: last_message
61
- type: decode_sentences
62
- - input_path: []
63
- retained_fields:
64
- e: explanation
65
- f: faithfulness_likelihood
66
- response_begin: response_begin
67
- response_end: response_end
68
- response_text: response_text
69
- type: project
 
1
+ model: null
2
+ response_format: null
3
+ transformations:
4
+ - type: likelihood
5
+ categories_to_values:
6
+ faithful: 1.0
7
+ partial: 0.5
8
+ unfaithful: 0.0
9
+ input_path:
10
+ - null
11
+ - f
12
+ - type: decode_sentences
13
+ source: last_message
14
+ input_path:
15
+ - null
16
+ - r
17
+ output_names:
18
+ begin: response_begin
19
+ end: response_end
20
+ text: response_text
21
+ - type: project
22
+ input_path: []
23
+ retained_fields:
24
+ response_begin: response_begin
25
+ response_end: response_end
26
+ response_text: response_text
27
+ f: faithfulness_likelihood
28
+ e: explanation
29
  instruction: 'Split the last assistant response into individual sentences. For each
30
  sentence in the last assistant response, identify the faithfulness by comparing
31
  with the provided documents and generate the faithfulness reasoning and faithfulness
 
34
  decision. The output must be a json structure.
35
 
36
  '
 
37
  parameters:
 
38
  response_format:
39
  $defs:
40
  HallucinationOutputEntry:
41
  properties:
42
+ r:
43
+ minimum: 0
44
+ title: Sentence Num
45
+ type: integer
46
  f:
47
+ title: Is Faithful
48
+ type: string
49
  enum:
50
  - faithful
51
  - partial
52
  - unfaithful
53
+ e:
54
+ title: Reasoning
55
  type: string
 
 
 
 
56
  required:
57
  - r
58
  - e
 
63
  $ref: '#/$defs/HallucinationOutputEntry'
64
  title: HallucinationOutput
65
  type: array
66
+ max_tokens: 4096
67
  sentence_boundaries:
68
  last_message: i
69
+ docs_as_message: roles
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
query_rewrite/granite4_micro/lora/io.yaml CHANGED
@@ -1,8 +1,8 @@
1
- docs_as_message: roles
2
- instruction: null
3
  model: null
 
 
 
4
  parameters:
5
- max_tokens: 1024
6
  response_format:
7
  properties:
8
  rewritten_question:
@@ -12,6 +12,6 @@ parameters:
12
  - rewritten_question
13
  title: QueryRewriteOutput
14
  type: object
15
- response_format: null
16
  sentence_boundaries: false
17
- transformations: null
 
 
 
1
  model: null
2
+ response_format: null
3
+ transformations: null
4
+ instruction: null
5
  parameters:
 
6
  response_format:
7
  properties:
8
  rewritten_question:
 
12
  - rewritten_question
13
  title: QueryRewriteOutput
14
  type: object
15
+ max_tokens: 1024
16
  sentence_boundaries: false
17
+ docs_as_message: roles