Comments (5)
I am using NixOS, I made a virtual env in a Nix shell as follow :
I used this shell.nix file (basically to enable the use of virtualenv without having it on the whole system):
{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
name = "pipzone";
targetPkgs = pkgs: (with pkgs; [
python310
python310Packages.pip
python310Packages.virtualenv
]);
runScript = "bash";
}).env
Then :
nix-shell shell.nix
virtualenv venv
pip install -r requirements.txt
source venv/bin/activate
I will try to see if I can find anything.
from turbopilot.
Ok so it was not how to do it, it returned errors.
I asked chatGPT to help me with this and it gave me this script, which seems to work :
import torch
import sys
import os
if len(sys.argv) < 3:
print("Usage: python combine_model_files.py <model_directory> <output_file_name>")
sys.exit(1)
model_directory = sys.argv[1]
output_file_name = sys.argv[2]
model_files = [file for file in os.listdir(model_directory) if file.startswith("pytorch_model-") and file.endswith(".bin")]
if not model_files:
print("No model files found in the specified directory.")
sys.exit(1)
combined_state_dict = {}
for model_file in sorted(model_files):
file_path = os.path.join(model_directory, model_file)
partial_state_dict = torch.load(file_path, map_location="cpu")
combined_state_dict.update(partial_state_dict)
output_file_path = os.path.join(model_directory, output_file_name)
torch.save(combined_state_dict, output_file_path)
print(f"Combined model saved as {output_file_path}")
The docker instance launched successfully, I could convert and quantize with no problem.
from turbopilot.
Hey @PierreFrn
Thanks for doing some digging here. It's strange that you were getting that error before. Can I double check what OS you're running and whether you were using python3 with the requirements from requirements.txt
to run the script?
Transformers 4.27
when paired with accelerate
should automatically load sharded models (the ones with multiple bins that you describe) without the need for a manual conversion. Here is the output I get on my system
$ conda create -n tbp python=3.10
Collecting package metadata (current_repodata.json): done
Solving environment: done
...
Then
conda activate tbp
pip install -r turbopilot/requirements.txt
Then if I activate the environment and run the script, it loads the shards:
python turbopilot/convert-codegen-to-ggml.py ./codegen-6B-multi-gptj 1
Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]
I'm guessing there's some discrepancy between operating systems or library behaviour at play here. Thanks for supplying the conversion script you used. I will add this thread to the documentation just in case others run into the same limitation.
from turbopilot.
(Leaving open in case you reply and we're able to work out what is going on)
from turbopilot.
Thanks a lot - let me know if you figure out the weirdness. For now, I documented this thread in the model conversion wiki page.
from turbopilot.
Related Issues (20)
- Binary for MacOS? HOT 2
- Can TurboPilot be configured to work with the official VSCode Copilot plugin? HOT 4
- Fail to use it locally HOT 4
- can't find the image of turbopilot from ghcr.io HOT 1
- how to convert a new codegen model to ggml HOT 3
- What would it take to train it for other languages? HOT 1
- I am new and Confused about the correct step for the section of "getting started" HOT 2
- error with today's new PR HOT 7
- "symbol not found" error in docker image running under WSL2 HOT 4
- Need Elixir Language Support HOT 3
- The new CodeGen2 Release HOT 3
- Support Windows Builds HOT 5
- Support starcoder HOT 1
- CUDA Support HOT 1
- Investigate tokenizer behaviour to understand why it is different to Huggingface Tokenizer HOT 6
- Wasn't able to get the docker image running (Illegal instruction (core dumped)) (no AVX support?) HOT 9
- Not getting any predictions - but posting to turbopilot.......... HOT 6
- arm64 image HOT 2
- No binary 0.0.2 release HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbopilot.