michaeldinzinger commited on
Commit
1c07095
·
1 Parent(s): aa8125e

Add model.safetensors

Browse files
Files changed (4) hide show
  1. .gitignore +3 -1
  2. model.safetensors +3 -0
  3. pyproject.toml +21 -0
  4. save_safetensors.py +15 -0
.gitignore CHANGED
@@ -1 +1,3 @@
1
- .env
 
 
 
1
+ .env
2
+ poetry.lock
3
+ **/__pycache__/
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6568a2d076cebd79d89cb85deee825af882e7c1f51d45e1217c3678f6aaee126
3
+ size 571419240
pyproject.toml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["poetry-core"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "arctic-m-bge-small"
7
+ version = "1.0.0"
8
+ description = "Upload ConcatModels."
9
+ authors = [
10
+ "Michael Dinzinger"
11
+ ]
12
+ homepage = "https://www.fim.uni-passau.de"
13
+ repository = "https://www.fim.uni-passau.de"
14
+ readme = "README.md"
15
+ license = "MIT"
16
+ package-mode = false
17
+
18
+ [tool.poetry.dependencies]
19
+ python = ">=3.10,<3.12"
20
+ transformers = "4.42.3"
21
+ torch = "2.5.0"
save_safetensors.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from safetensors.torch import save_file
2
+ from modeling_arctic_m_bge_small import ConcatModel, ConcatModelConfig
3
+
4
+ config = ConcatModelConfig()
5
+ model = ConcatModel(config)
6
+ model.load_weights_from_automodels(
7
+ in_models=['Snowflake/snowflake-arctic-embed-m-v1.5', 'BAAI/bge-small-en-v1.5'],
8
+ has_pooling_layer=[True, True]
9
+ )
10
+
11
+ state_dict = model.state_dict()
12
+ output_path = 'model.safetensors'
13
+ save_file(state_dict, output_path)
14
+
15
+ print(f'Model saved as {output_path}')