MekkCyber commited on
Commit
db25e46
·
1 Parent(s): 114827e
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -73,6 +73,7 @@ base_model:
73
  # Add any original YAML fields except base_model
74
  if original_yaml_header:
75
  in_base_model_section = False
 
76
  for line in original_yaml_header.strip().split('\n'):
77
  # Skip if we're in a base_model section that continues to the next line
78
  if in_base_model_section:
@@ -88,8 +89,20 @@ base_model:
88
  if ':' in line and len(line.split(':', 1)[1].strip()) > 0:
89
  in_base_model_section = False
90
  continue
 
 
 
 
 
 
 
91
 
92
  yaml_header += f"\n{line}"
 
 
 
 
 
93
  # Complete the YAML header
94
  yaml_header += "\n---"
95
 
@@ -100,7 +113,7 @@ base_model:
100
  ## Description
101
  This model is a quantized version of the original model [`{model_name}`](https://huggingface.co/{model_name}).
102
 
103
- It's quantized using the BitsAndBytes library to 4-bit using the [bnb-my-repo](https://huggingface.co/spaces/HF-Quantization/bnb-my-repo) space.
104
 
105
  ## Quantization Details
106
  - **Quantization Type**: int4
 
73
  # Add any original YAML fields except base_model
74
  if original_yaml_header:
75
  in_base_model_section = False
76
+ found_tags = False
77
  for line in original_yaml_header.strip().split('\n'):
78
  # Skip if we're in a base_model section that continues to the next line
79
  if in_base_model_section:
 
89
  if ':' in line and len(line.split(':', 1)[1].strip()) > 0:
90
  in_base_model_section = False
91
  continue
92
+
93
+ # Check for tags field and add bnb-my-repo
94
+ if line.strip().startswith('tags:'):
95
+ found_tags = True
96
+ yaml_header += f"\n{line}"
97
+ yaml_header += "\n- bnb-my-repo"
98
+ continue
99
 
100
  yaml_header += f"\n{line}"
101
+
102
+ # If tags field wasn't found, add it
103
+ if not found_tags:
104
+ yaml_header += "\ntags:"
105
+ yaml_header += "\n- bnb-my-repo"
106
  # Complete the YAML header
107
  yaml_header += "\n---"
108
 
 
113
  ## Description
114
  This model is a quantized version of the original model [`{model_name}`](https://huggingface.co/{model_name}).
115
 
116
+ It's quantized using the BitsAndBytes library to 4-bit using the [bnb-my-repo](https://huggingface.co/spaces/bnb-community/bnb-my-repo) space.
117
 
118
  ## Quantization Details
119
  - **Quantization Type**: int4