Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- models/gguf/convert_hf_to_gguf.py +56 -0
- models/gguf/isaac_sim_qwen2.5_coder_f16.gguf +3 -0
- models/gguf/quantize_4bit.py +43 -0
- models/gguf/quantize_8bit.py +43 -0
- models/gguf/upload_to_hf.py +182 -0
.gitattributes
CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
models/huggingface/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
37 |
models/ctransformers/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
models/huggingface/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
37 |
models/ctransformers/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
38 |
+
models/gguf/isaac_sim_qwen2.5_coder_f16.gguf filter=lfs diff=lfs merge=lfs -text
|
models/gguf/convert_hf_to_gguf.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
"""
|
3 |
+
llama.cpp Hugging Face to GGUF conversion script
|
4 |
+
"""
|
5 |
+
|
6 |
+
import os
|
7 |
+
import sys
|
8 |
+
import json
|
9 |
+
import subprocess
|
10 |
+
from pathlib import Path
|
11 |
+
|
12 |
+
def main():
|
13 |
+
# Model paths
|
14 |
+
model_path = "trained_models/isaac_sim_hf/complete_merged_model"
|
15 |
+
output_path = "trained_models/isaac_sim_hf/gguf_final/isaac_sim_qwen2.5_coder.gguf"
|
16 |
+
|
17 |
+
print(f"Converting {model_path} to {output_path}")
|
18 |
+
|
19 |
+
# Use llama.cpp convert_hf_to_gguf.py script directly
|
20 |
+
convert_script = "/mnt/s/Train a Reasoning Model with NeMo/llama.cpp/convert_hf_to_gguf.py"
|
21 |
+
if not os.path.exists(convert_script):
|
22 |
+
print(f"❌ Convert script not found: {convert_script}")
|
23 |
+
return False
|
24 |
+
|
25 |
+
# Run the conversion using llama.cpp convert_hf_to_gguf.py
|
26 |
+
cmd = [
|
27 |
+
sys.executable, convert_script,
|
28 |
+
model_path,
|
29 |
+
"--outfile", output_path,
|
30 |
+
"--outtype", "f16",
|
31 |
+
"--model-type", "qwen2"
|
32 |
+
]
|
33 |
+
|
34 |
+
try:
|
35 |
+
print(f"Running: {' '.join(cmd)}")
|
36 |
+
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
|
37 |
+
print("✅ Conversion completed successfully")
|
38 |
+
print(f"Output: {result.stdout}")
|
39 |
+
|
40 |
+
# Show file info
|
41 |
+
if os.path.exists(output_path):
|
42 |
+
size_mb = os.path.getsize(output_path) / (1024 * 1024)
|
43 |
+
print(f"📁 Output file size: {size_mb:.1f} MB")
|
44 |
+
|
45 |
+
except subprocess.CalledProcessError as e:
|
46 |
+
print(f"❌ Conversion failed: {e.stderr}")
|
47 |
+
return False
|
48 |
+
except Exception as e:
|
49 |
+
print(f"❌ Unexpected error: {str(e)}")
|
50 |
+
return False
|
51 |
+
|
52 |
+
return True
|
53 |
+
|
54 |
+
if __name__ == "__main__":
|
55 |
+
success = main()
|
56 |
+
sys.exit(0 if success else 1)
|
models/gguf/isaac_sim_qwen2.5_coder_f16.gguf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eccb65c5caa078da76e0856f6ea7237508bc4dbf27754fe64bdb592d24c1dae1
|
3 |
+
size 645950144
|
models/gguf/quantize_4bit.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
"""
|
3 |
+
4-bit quantization script
|
4 |
+
"""
|
5 |
+
|
6 |
+
import os
|
7 |
+
import subprocess
|
8 |
+
import sys
|
9 |
+
|
10 |
+
def quantize_4bit():
|
11 |
+
input_path = "trained_models/isaac_sim_hf/gguf_final/isaac_sim_qwen2.5_coder.gguf"
|
12 |
+
output_path = "trained_models/isaac_sim_hf/gguf_final/isaac_sim_qwen2.5_coder_q4_0.gguf"
|
13 |
+
|
14 |
+
if not os.path.exists(input_path):
|
15 |
+
print(f"❌ Input file not found: {input_path}")
|
16 |
+
return False
|
17 |
+
|
18 |
+
print(f"🔢 Quantizing to 4-bit: {input_path} -> {output_path}")
|
19 |
+
|
20 |
+
cmd = [
|
21 |
+
"../../llama.cpp/build/bin/llama-quantize",
|
22 |
+
input_path,
|
23 |
+
output_path,
|
24 |
+
"q4_0"
|
25 |
+
]
|
26 |
+
|
27 |
+
try:
|
28 |
+
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
|
29 |
+
print("✅ 4-bit quantization completed")
|
30 |
+
|
31 |
+
if os.path.exists(output_path):
|
32 |
+
size_mb = os.path.getsize(output_path) / (1024 * 1024)
|
33 |
+
print(f"📁 4-bit file size: {size_mb:.1f} MB")
|
34 |
+
|
35 |
+
return True
|
36 |
+
|
37 |
+
except subprocess.CalledProcessError as e:
|
38 |
+
print(f"❌ 4-bit quantization failed: {e.stderr}")
|
39 |
+
return False
|
40 |
+
|
41 |
+
if __name__ == "__main__":
|
42 |
+
success = quantize_4bit()
|
43 |
+
sys.exit(0 if success else 1)
|
models/gguf/quantize_8bit.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
"""
|
3 |
+
8-bit quantization script
|
4 |
+
"""
|
5 |
+
|
6 |
+
import os
|
7 |
+
import subprocess
|
8 |
+
import sys
|
9 |
+
|
10 |
+
def quantize_8bit():
|
11 |
+
input_path = "trained_models/isaac_sim_hf/gguf_final/isaac_sim_qwen2.5_coder.gguf"
|
12 |
+
output_path = "trained_models/isaac_sim_hf/gguf_final/isaac_sim_qwen2.5_coder_q8_0.gguf"
|
13 |
+
|
14 |
+
if not os.path.exists(input_path):
|
15 |
+
print(f"❌ Input file not found: {input_path}")
|
16 |
+
return False
|
17 |
+
|
18 |
+
print(f"🔢 Quantizing to 8-bit: {input_path} -> {output_path}")
|
19 |
+
|
20 |
+
cmd = [
|
21 |
+
"../../llama.cpp/build/bin/llama-quantize",
|
22 |
+
input_path,
|
23 |
+
output_path,
|
24 |
+
"q8_0"
|
25 |
+
]
|
26 |
+
|
27 |
+
try:
|
28 |
+
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
|
29 |
+
print("✅ 8-bit quantization completed")
|
30 |
+
|
31 |
+
if os.path.exists(output_path):
|
32 |
+
size_mb = os.path.getsize(output_path) / (1024 * 1024)
|
33 |
+
print(f"📁 8-bit file size: {size_mb:.1f} MB")
|
34 |
+
|
35 |
+
return True
|
36 |
+
|
37 |
+
except subprocess.CalledProcessError as e:
|
38 |
+
print(f"❌ 8-bit quantization failed: {e.stderr}")
|
39 |
+
return False
|
40 |
+
|
41 |
+
if __name__ == "__main__":
|
42 |
+
success = quantize_8bit()
|
43 |
+
sys.exit(0 if success else 1)
|
models/gguf/upload_to_hf.py
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
"""
|
3 |
+
Hugging Face upload script for Isaac Sim model
|
4 |
+
"""
|
5 |
+
|
6 |
+
import os
|
7 |
+
import json
|
8 |
+
import subprocess
|
9 |
+
from pathlib import Path
|
10 |
+
|
11 |
+
def create_model_card():
|
12 |
+
"""Create a comprehensive model card for Hugging Face"""
|
13 |
+
|
14 |
+
model_card = """---
|
15 |
+
language:
|
16 |
+
- en
|
17 |
+
- code
|
18 |
+
license: mit
|
19 |
+
model_creator: Isaac Sim Development Team
|
20 |
+
model_name: Isaac Sim Qwen2.5 Coder 7B
|
21 |
+
model_type: qwen2
|
22 |
+
pipeline_tag: text-generation
|
23 |
+
prompt_template: |
|
24 |
+
<|im_start|>system
|
25 |
+
You are an expert in Isaac Sim 5.0, Isaac Lab 2.1, and Omniverse Kit 107.3 robotics development. You help users with:
|
26 |
+
- Isaac Sim simulation setup and configuration
|
27 |
+
- Isaac Lab Jupyter notebook workflows
|
28 |
+
- Omniverse Kit extension development
|
29 |
+
- Robot and sensor integration
|
30 |
+
- USD (Universal Scene Description) workflows
|
31 |
+
- Python robotics programming
|
32 |
+
- Synthetic data generation for training
|
33 |
+
Always provide accurate, up-to-date information and code examples.
|
34 |
+
<|im_end|>
|
35 |
+
<|im_start|>user
|
36 |
+
{prompt}
|
37 |
+
<|im_end|>
|
38 |
+
<|im_start|>assistant
|
39 |
+
{response}
|
40 |
+
<|im_end|>
|
41 |
+
quantized_by: bitsandbytes
|
42 |
+
tags:
|
43 |
+
- isaac-sim
|
44 |
+
- robotics
|
45 |
+
- omniverse
|
46 |
+
- code-generation
|
47 |
+
- synthetic-data
|
48 |
+
- qwen2
|
49 |
+
---
|
50 |
+
|
51 |
+
# Isaac Sim Qwen2.5 Coder 7B
|
52 |
+
|
53 |
+
A specialized version of Qwen2.5-Coder-7B-Instruct fine-tuned for Isaac Sim 5.0, Isaac Lab 2.1, and Omniverse Kit 107.3 development.
|
54 |
+
|
55 |
+
## Model Description
|
56 |
+
|
57 |
+
This model is specifically trained to assist with:
|
58 |
+
- Isaac Sim robotics simulation development
|
59 |
+
- Isaac Lab Jupyter notebook workflows
|
60 |
+
- Omniverse Kit extension development
|
61 |
+
- Robot and sensor integration
|
62 |
+
- USD (Universal Scene Description) workflows
|
63 |
+
- Python robotics programming
|
64 |
+
- Synthetic data generation for training
|
65 |
+
|
66 |
+
## Training Data
|
67 |
+
|
68 |
+
The model was fine-tuned on a comprehensive dataset of:
|
69 |
+
- Isaac Sim 5.0 documentation and examples
|
70 |
+
- Isaac Lab 2.1 tutorials and workflows
|
71 |
+
- Omniverse Kit 107.3 extension development
|
72 |
+
- Robotics simulation scenarios
|
73 |
+
- USD workflow examples
|
74 |
+
- Python robotics code samples
|
75 |
+
|
76 |
+
## Usage
|
77 |
+
|
78 |
+
The model supports the Qwen2 chat template format and can be used for:
|
79 |
+
- Code generation and completion
|
80 |
+
- Technical documentation
|
81 |
+
- Robotics simulation guidance
|
82 |
+
- Extension development assistance
|
83 |
+
- Troubleshooting and debugging
|
84 |
+
|
85 |
+
## Quantization
|
86 |
+
|
87 |
+
This repository provides multiple quantization levels:
|
88 |
+
- **Full Precision (f16):** Highest quality, requires ~14GB VRAM
|
89 |
+
- **8-bit Quantized (q8_0):** Good balance, requires ~7GB VRAM
|
90 |
+
- **4-bit Quantized (q4_0):** Memory efficient, requires ~4GB VRAM
|
91 |
+
|
92 |
+
## Hardware Requirements
|
93 |
+
|
94 |
+
- **Minimum:** 4GB VRAM (4-bit quantized)
|
95 |
+
- **Recommended:** 8GB VRAM (8-bit quantized)
|
96 |
+
- **Optimal:** 16GB+ VRAM (full precision)
|
97 |
+
|
98 |
+
## License
|
99 |
+
|
100 |
+
This model is based on Qwen2.5-Coder-7B-Instruct and follows the same license terms.
|
101 |
+
"""
|
102 |
+
|
103 |
+
return model_card
|
104 |
+
|
105 |
+
def create_repo_structure():
|
106 |
+
"""Create the repository structure for Hugging Face"""
|
107 |
+
|
108 |
+
# Create directories
|
109 |
+
hf_dir = "huggingface_repo"
|
110 |
+
if os.path.exists(hf_dir):
|
111 |
+
shutil.rmtree(hf_dir)
|
112 |
+
|
113 |
+
os.makedirs(hf_dir)
|
114 |
+
os.makedirs(os.path.join(hf_dir, "gguf"))
|
115 |
+
|
116 |
+
# Copy GGUF files
|
117 |
+
gguf_files = [
|
118 |
+
"isaac_sim_qwen2.5_coder.gguf",
|
119 |
+
"isaac_sim_qwen2.5_coder_q8_0.gguf",
|
120 |
+
"isaac_sim_qwen2.5_coder_q4_0.gguf"
|
121 |
+
]
|
122 |
+
|
123 |
+
for file in gguf_files:
|
124 |
+
src = os.path.join(".", file)
|
125 |
+
dst = os.path.join(hf_dir, "gguf", file)
|
126 |
+
if os.path.exists(src):
|
127 |
+
shutil.copy2(src, dst)
|
128 |
+
print(f"✅ Copied vocab.json")
|
129 |
+
|
130 |
+
# Create model card
|
131 |
+
model_card = create_model_card()
|
132 |
+
with open(os.path.join(hf_dir, "README.md"), "w") as f:
|
133 |
+
f.write(model_card)
|
134 |
+
|
135 |
+
# Create .gitattributes
|
136 |
+
gitattributes = """*.gguf filter=lfs diff=lfs merge=lfs -text
|
137 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
138 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
139 |
+
*.json text
|
140 |
+
*.md text
|
141 |
+
*.py text
|
142 |
+
"""
|
143 |
+
|
144 |
+
with open(os.path.join(hf_dir, ".gitattributes"), "w") as f:
|
145 |
+
f.write(gitattributes)
|
146 |
+
|
147 |
+
# Create requirements.txt
|
148 |
+
requirements = """llama-cpp-python>=0.2.0
|
149 |
+
transformers>=4.52.0
|
150 |
+
torch>=2.0.0
|
151 |
+
"""
|
152 |
+
|
153 |
+
with open(os.path.join(hf_dir, "requirements.txt"), "w") as f:
|
154 |
+
f.write(requirements)
|
155 |
+
|
156 |
+
print(f"✅ Hugging Face repository structure created successfully")
|
157 |
+
return True
|
158 |
+
|
159 |
+
def main():
|
160 |
+
"""Main function"""
|
161 |
+
print("🚀 Creating Hugging Face repository structure...")
|
162 |
+
|
163 |
+
create_repo_structure()
|
164 |
+
|
165 |
+
print(f"
|
166 |
+
📁 Repository created successfully!")
|
167 |
+
print("
|
168 |
+
📋 Next steps:")
|
169 |
+
print("1. Review the repository structure")
|
170 |
+
print("2. Initialize git repository")
|
171 |
+
print("3. Push to Hugging Face")
|
172 |
+
print("
|
173 |
+
💡 Commands:")
|
174 |
+
print("cd huggingface_repo")
|
175 |
+
print("git init")
|
176 |
+
print("git add .")
|
177 |
+
print("git commit -m 'Initial commit: Isaac Sim Qwen2.5 Coder model'")
|
178 |
+
print("git remote add origin https://huggingface.co/YOUR_USERNAME/isaac-sim-qwen2.5-coder")
|
179 |
+
print("git push -u origin main")
|
180 |
+
|
181 |
+
if __name__ == "__main__":
|
182 |
+
main()
|