-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
573 lines (497 loc) · 22.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
SHELL := /bin/bash
# Disable built-in rules and variables
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
NETWORK ?= local
DFX_WEBSERVER_PORT ?= $(shell dfx info webserver-port)
IDENTITY ?= $(shell dfx identity whoami)
###########################################################################
# Some constants
CANISTER_INSTALL_MODE ?= install
CANISTER_CANDID_UI_IC ?= "a4gq6-oaaaa-aaaab-qaa4q-cai"
###########################################################################
.PHONY: all-static
all-static: \
python-format python-lint \
javascript-format javascript-lint
.PHONY: all-static-check
all-static-check: \
python-format-check python-lint-check python-type-check \
javascript-format-check javascript-lint-check
git-no-unstaged-files:
@if [[ $$(git diff --name-only) ]]; then \
echo " "; \
echo "Unstaged Files ($$(git diff --name-only | wc -w)):"; \
git diff --name-only | awk '{print "- " $$1}'; \
echo " "; \
echo "There are unstaged files in your working directory."; \
echo "Please only deploy to ic from a freshly pulled main branch."; \
echo " "; \
exit 1; \
else \
echo "Ok, you have no unstaged files in your working directory." ;\
fi
git-no-staged-files:
@if [[ $$(git diff --cached --name-only) ]]; then \
echo " "; \
echo "Staged Files ($$(git diff --cached --name-only | wc -w)):"; \
git diff --cached --name-only | awk '{print "- " $$1}'; \
echo " "; \
echo "There are staged files in your working directory."; \
echo "Please only deploy to ic from a freshly pulled main branch."; \
echo " "; \
exit 1; \
else \
echo "Ok, you have no staged files in your working directory." ;\
fi
git-on-origin-main:
@if [[ $$(git log origin/main..HEAD --first-parent --oneline | awk '{print $$1}' | wc -w) > 0 ]]; then \
echo " "; \
echo "Your working directory is not at origin/main:"; \
git log origin/main..HEAD --first-parent --oneline --boundary; \
echo " "; \
echo "Please only deploy to ic from a freshly pulled main branch."; \
echo " "; \
exit 1; \
else \
echo "Ok, your working directory is at orgin/main" ;\
fi
# This installs ~/bin/dfx
# Make sure to source ~/.profile afterwards -> it adds ~/bin to the path if it exists
.PHONY: dfx-install
dfx-install:
sh -ci "$$(curl -fsSL https://sdk.dfinity.org/install.sh)"
.PHONY: dfx-cycles-to-llama2_15M
dfx-cycles-to-llama2_15M:
@$(eval CANISTER_ID_LLAMA2_15M := $(shell dfx canister --network ic id llama2_15M))
@echo "-------------------------------------------------------------------------"
@echo "dfx identity : $(IDENTITY)"
@echo "- balance before: "
@dfx wallet --network ic balance
# @echo "-------------------------------------------------------------------------"
# @echo "llama2_15M canister before : $(CANISTER_ID_LLAMA2_15M)"
# @dfx canister --network=ic status llama2_15M
@echo "-------------------------------------------------------------------------"
@echo "Sending 0.5T cycles to llama2_15M"
dfx wallet --network ic send $(CANISTER_ID_LLAMA2_15M) 500000000000
@echo "-------------------------------------------------------------------------"
@echo "dfx identity : $(IDENTITY)"
@echo "- balance after: "
@dfx wallet --network ic balance
@echo "-------------------------------------------------------------------------"
@echo "llama2_15M canister after : $(CANISTER_ID_LLAMA2_15M)"
@dfx canister --network=ic status llama2_15M
.PHONY: dfx-cycles-to-frontend
dfx-cycles-to-frontend:
@$(eval CANISTER_FRONTEND_ID := $(shell dfx canister --network ic id canister_frontend))
@echo "-------------------------------------------------------------------------"
@echo "dfx identity : $(IDENTITY)"
@echo "- balance before: "
@dfx wallet --network ic balance
@echo "-------------------------------------------------------------------------"
@echo "canister_frontend canister before : $(CANISTER_FRONTEND_ID)"
@dfx canister --network=ic status canister_frontend
@echo "-------------------------------------------------------------------------"
@echo "Sending 0.5T cycles to canister_frontend"
dfx wallet --network ic send $(CANISTER_FRONTEND_ID) 500000000000
@echo "-------------------------------------------------------------------------"
@echo "dfx identity : $(IDENTITY)"
@echo "- balance after: "
@dfx wallet --network ic balance
@echo "-------------------------------------------------------------------------"
@echo "canister_frontend canister after : $(CANISTER_FRONTEND_ID)"
@dfx canister --network=ic status canister_frontend
.PHONY: dfx-canisters-of-project-ic
dfx-canisters-of-project-ic:
@$(eval IDENTITY_PRINCIPAL := $(shell dfx identity --network ic get-principal))
@$(eval IDENTITY_CYCLES_WALLET := $(shell dfx identity --network ic get-wallet))
@$(eval IDENTITY_ICP_WALLET := $(shell dfx ledger --network ic account-id))
@$(eval IDENTITY_ICP_BALANCE := $(shell dfx ledger --network ic balance))
@$(eval IC_CANISTER_ID_FRONTEND := $(shell dfx canister --network ic id canister_frontend))
@$(eval IC_CANISTER_ID_LLAMA2_260K := $(shell dfx canister --network ic id llama2_260K))
@$(eval IC_CANISTER_ID_LLAMA2_15M := $(shell dfx canister --network ic id llama2_15M))
@$(eval IC_CANISTER_ID_LLAMA2_42M := $(shell dfx canister --network ic id llama2_42M))
@$(eval IC_CANISTER_ID_LLAMA2_110M := $(shell dfx canister --network ic id llama2_110M))
@$(eval IC_CANISTER_ID_LLAMA_CPP_QWEN25_05B_Q8 := $(shell dfx canister --network ic id llama_cpp_qwen25_05b_q8))
@$(eval IC_CANISTER_ID_LLAMA_CPP_CHARLES_42M := $(shell dfx canister --network ic id llama_cpp_charles_42m))
@echo '-------------------------------------------------'
@echo "NETWORK : ic"
@echo "dfx identity : $(IDENTITY)"
@echo "identity's principal : $(IDENTITY_PRINCIPAL)"
@echo "identity's cycles wallet : $(IDENTITY_CYCLES_WALLET)"
@echo "identity's ICP wallet : $(IDENTITY_ICP_WALLET)"
@echo "identity's ICP balance : $(IDENTITY_ICP_BALANCE)"
@echo '-------------------------------------------------'
@echo "identity's cycles wallet : $(IDENTITY_CYCLES_WALLET)"
@echo "- balance: "
@dfx wallet --network ic balance
@echo "- status: "
@dfx canister --network=ic status $(IDENTITY_CYCLES_WALLET)
@echo '-------------------------------------------------'
@echo "canister_frontend : $(IC_CANISTER_ID_FRONTEND)"
@dfx canister --network=ic status canister_frontend
@echo '-------------------------------------------------'
@echo "llama2_260K canister : $(IC_CANISTER_ID_LLAMA2_260K)"
@dfx canister --network=ic status llama2_260K
@echo '-------------------------------------------------'
@echo "llama2_15M canister (15M) : $(IC_CANISTER_ID_LLAMA2_15M)"
@dfx canister --network=ic status llama2_15M
@echo '-------------------------------------------------'
@echo "llama2_42M canister : $(IC_CANISTER_ID_LLAMA2_42M)"
@dfx canister --network=ic status llama2_42M
@echo '-------------------------------------------------'
@echo "llama2_110M canister : $(IC_CANISTER_ID_LLAMA2_110M)"
@dfx canister --network=ic status llama2_110M
@echo '-------------------------------------------------'
@echo "llama_cpp_qwen25_05b_q8 canister : $(IC_CANISTER_ID_LLAMA_CPP_QWEN25_05B_Q8)"
@dfx canister --network=ic status llama_cpp_qwen25_05b_q8
@echo '-------------------------------------------------'
@echo "llama_cpp_charles_42m canister : $(IC_CANISTER_ID_LLAMA_CPP_CHARLES_42M)"
@dfx canister --network=ic status llama_cpp_charles_42m
@echo '-------------------------------------------------'
@echo 'View in browser at:'
@echo "canister_frontend (ICGPT) : https://$(CANISTER_FRONTEND).ic0.app/"
@echo "identity's wallet : https://$(IDENTITY_CYCLES_WALLET).raw.ic0.app/"
@echo "Candid UI : https://$(CANISTER_CANDID_UI_IC).raw.ic0.app/"
@echo "Candid UI of canister_frontend : https://$(CANISTER_CANDID_UI_IC).raw.ic0.app/?id=$(CANISTER_FRONTEND)"
.PHONY: dfx-canisters-of-project-local
dfx-canisters-of-project-local:
@$(eval IDENTITY_CYCLES_WALLET := $(shell dfx identity get-wallet))
@$(eval CANISTER_CANDID_UI_LOCAL ?= $(shell dfx canister id __Candid_UI))
@$(eval CANISTER_FRONTEND := $(shell dfx canister id canister_frontend))
@echo '-------------------------------------------------'
@echo "NETWORK : local"
@echo "cycles canister : $(IDENTITY_CYCLES_WALLET)"
@echo "Candid UI canister : $(CANISTER_CANDID_UI_IC)"
@echo "canister_frontend : $(CANISTER_FRONTEND)"
@echo '-------------------------------------------------'
@echo 'View in browser at:'
@echo "__Candid_UI : http://localhost:$(DFX_WEBSERVER_PORT)?canisterId=$(CANISTER_CANDID_UI_LOCAL)"
@echo "Candid UI of canister_frontend : http://localhost:$(DFX_WEBSERVER_PORT)?canisterId=$(CANISTER_CANDID_UI_LOCAL)&id=$(CANISTER_FRONTEND)"
@echo "canister_frontend : http://localhost:$(DFX_WEBSERVER_PORT)?canisterId=$(CANISTER_FRONTEND)"
.PHONY: dfx-canisters-of-project
dfx-canisters-of-project:
@if [[ ${NETWORK} == "ic" ]]; then \
make --no-print-directory dfx-canisters-of-project-ic; \
else \
make --no-print-directory dfx-canisters-of-project-local; \
fi
.PHONY: dfx-canister-methods
dfx-canister-methods:
@echo "make dfx-canister-methods CANISTER_NAME=$(CANISTER_NAME)"
@echo "NETWORK : $(NETWORK)"
@echo "CANISTER_NAME : $(CANISTER_NAME)"
@echo "View the canister's interface (i.e. the candid methods) at :"
@echo "- Candid UI: https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.ic0.app/?id=$(CANISTER_NAME)"
@echo "- icrocks : https://ic.rocks/principal/$(CANISTER_NAME)"
@echo "- Canlist : https://k7gat-daaaa-aaaae-qaahq-cai.ic0.app/search?s=$(CANISTER_NAME)"
@echo "-------------------------------------------------------------------------"
@echo "Checking if it is listed at Canlista"
@dfx canister --network $(NETWORK) call kyhgh-oyaaa-aaaae-qaaha-cai getCandid '(principal "$(CANISTER_NAME)")'
.PHONY: dfx-canister-create
dfx-canister-create:
@echo "make dfx-canister-create CANISTER_NAME=$(CANISTER_NAME)"
@echo "NETWORK : $(NETWORK)"
@echo "CANISTER_NAME : $(CANISTER_NAME)"
@dfx canister --network $(NETWORK) create $(CANISTER_NAME)
.PHONY: dfx-canister-stop
dfx-canister-stop:
@echo "make dfx-canister-stop CANISTER_NAME=$(CANISTER_NAME)"
@echo "NETWORK : $(NETWORK)"
@echo "CANISTER_NAME : $(CANISTER_NAME)"
@dfx canister --network $(NETWORK) stop $(CANISTER_NAME)
.PHONY: dfx-canister-delete
dfx-canister-delete:
@echo "make dfx-canister-delete CANISTER_NAME=$(CANISTER_NAME)"
@echo "NETWORK : $(NETWORK)"
@echo "CANISTER_NAME : $(CANISTER_NAME)"
@dfx canister --network $(NETWORK) stop $(CANISTER_NAME)
@dfx canister --network $(NETWORK) delete $(CANISTER_NAME)
.PHONY: dfx-canister-install-upgrade
dfx-canister-install-upgrade:
@make --no-print-directory dfx-canister-install CANISTER_INSTALL_MODE=upgrade
.PHONY: dfx-canister-install-reinstall
dfx-canister-install-reinstall:
@make --no-print-directory dfx-canister-install CANISTER_INSTALL_MODE=reinstall
.PHONY: dfx-canister-install
dfx-canister-install:
@echo "make dfx-canister-install CANISTER_NAME=$(CANISTER_NAME)"
@echo "NETWORK : $(NETWORK)"
@echo "CANISTER_NAME : $(CANISTER_NAME)"
@dfx canister --network $(NETWORK) install --mode $(CANISTER_INSTALL_MODE) $(CANISTER_NAME)
.PHONY: dfx-canister-call
dfx-canister-call:
@dfx canister --network $(NETWORK) call --output $(CANISTER_OUTPUT) --type $(CANISTER_INPUT) $(CANISTER_NAME) $(CANISTER_METHOD) '$(CANISTER_ARGUMENT)'
.PHONY: dfx-deploy-local
dfx-deploy-local:
@echo " "
@dfx deploy
@echo "All done.... Getting details... "
@make --no-print-directory dfx-canisters-of-project
.PHONY: dfx-deploy-ic-frontend
dfx-deploy-ic-frontend:
@echo " "
@echo "--Deploy--"
@dfx deploy --network ic canister_frontend
@echo "--All done.... Get canister details..--"
@make --no-print-directory dfx-canisters-of-project NETWORK=ic
.PHONY: dfx-identity-and-wallet-for-cicd
dfx-identity-and-wallet-for-cicd:
@echo $(DFX_IDENTITY_PEM_ENCODED) | base64 --decode > identity-cicd.pem
@dfx identity import cicd ./identity-cicd.pem
@rm ./identity-cicd.pem
@dfx identity use cicd
@dfx identity --network ic set-wallet "$(DFX_WALLET_CANISTER_ID)"
.PHONY: dfx-identity-use
dfx-identity-use:
@dfx identity use $(IDENTITY)
.PHONY: dfx-identity-whoami
dfx-identity-whoami:
@echo -n $(shell dfx identity whoami)
.PHONY: dfx-identity-get-principal
dfx-identity-get-principal:
@echo -n $(shell dfx identity get-principal)
.PHONY: dfx-ping
dfx-ping:
@dfx ping $(NETWORK)
.PHONY: dfx-start-local
dfx-start-local:
@dfx stop
@dfx start --clean --background
.PHONY: dfx-stop-local
dfx-stop-local:
@dfx stop
.PHONY: dfx-wallet-details
dfx-wallet-details:
@$(eval IDENTITY_CYCLES_WALLET := $(shell dfx identity --network $(NETWORK) get-wallet))
@echo "-------------------------------------------------------------------------"
@echo "make dfx-wallet-details NETWORK=$(NETWORK)"
@if [[ ${NETWORK} == "ic" ]]; then \
echo "View details at : https://$(IDENTITY_CYCLES_WALLET).raw.ic0.app/"; \
else \
echo "View details at : ?? http://localhost:$(DFX_WEBSERVER_PORT)?canisterId=$(IDENTITY_CYCLES_WALLET) ?? "; \
fi
@echo "-------------------------------------------------------------------------"
@echo -n "cycles canister id : " && dfx identity --network $(NETWORK) get-wallet
@echo -n "cycles canister name : " && dfx wallet --network $(NETWORK) name
@echo -n "cycles canister balance : " && dfx wallet --network $(NETWORK) balance
@echo "-------------------------------------------------------------------------"
@echo "controllers: "
@dfx wallet --network $(NETWORK) controllers
@echo "-------------------------------------------------------------------------"
@echo "custodians: "
@dfx wallet --network $(NETWORK) custodians
@echo "-------------------------------------------------------------------------"
@echo "addresses: "
@dfx wallet --network $(NETWORK) addresses
.PHONY: dfx-wallet-controller-add
dfx-wallet-controller-add:
@[ "${PRINCIPAL}" ] || ( echo ">> Define PRINCIPAL to add as controller: 'make dfx-cycles-controller-add PRINCIPAL=....' "; exit 1 )
@echo "NETWORK : $(NETWORK)"
@echo "PRINCIPAL : $(PRINCIPAL)"
@dfx wallet --network $(NETWORK) add-controller $(PRINCIPAL)
.PHONY: dfx-wallet-controller-remove
dfx-wallet-controller-remove:
@[ "${PRINCIPAL}" ] || ( echo ">> Define PRINCIPAL to remove as controller: 'make dfx-cycles-controller-remove PRINCIPAL=....' "; exit 1 )
@echo "NETWORK : $(NETWORK)"
@echo "PRINCIPAL : $(PRINCIPAL)"
@dfx wallet --network $(NETWORK) remove-controller $(PRINCIPAL)
.PHONY: javascript-format
javascript-format:
@echo "---"
@echo "javascript-format"
npm run format:write
.PHONY: javascript-format-check
javascript-format-check:
@echo "---"
@echo "javascript-format-check"
npm run format:check
.PHONY: javascript-lint
javascript-lint:
@echo "---"
@echo "javascript-lint"
npm run lint:fix
.PHONY: javascript-lint-check
javascript-lint-check:
@echo "---"
@echo "javascript-lint-check"
npm run lint:check
.PHONY: python-clean
python-clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
PYTHON_DIRS ?= scripts
.PHONY: python-format
python-format:
@echo "---"
@echo "python-format"
python -m black $(PYTHON_DIRS)
.PHONY: python-format-check
python-format-check:
@echo "---"
@echo "python-format-check"
python -m black --check $(PYTHON_DIRS)
.PHONY: python-lint
python-lint:
@echo "---"
@echo "python-lint"
python -m pylint --jobs=0 --rcfile=.pylintrc $(PYTHON_DIRS)
.PHONY: python-lint-check
python-lint-check:
@echo "---"
@echo "python-lint-check"
python -m pylint --jobs=0 --rcfile=.pylintrc $(PYTHON_DIRS)
.PHONY: python-type-check
python-type-check:
@echo "---"
@echo "python-type-check"
python -m mypy --config-file .mypy.ini --show-column-numbers --strict $(PYTHON_DIRS)
###########################################################################
# Toolchain installation
.PHONY: install-all-ubuntu
install-all-ubuntu: install-jp-ubuntu install-dfx install-javascript install-python
.PHONY: install-all-mac
install-all-mac: install-jp-mac install-dfx install-javascript install-python
# This installs ~/bin/dfx
# Make sure to source ~/.profile afterwards -> it adds ~/bin to the path if it exists
.PHONY: install-dfx
install-dfx:
DFXVM_INIT_YES=true sh -ci "$$(curl -fsSL https://sdk.dfinity.org/install.sh)"
.PHONY: install-javascript
install-javascript:
npm install
.PHONY: install-jp-ubuntu
install-jp-ubuntu:
sudo apt-get update && sudo apt-get install jp
.PHONY: install-jp-mac
install-jp-mac:
brew install jp
.PHONY: install-python
install-python:
pip install --upgrade pip
pip install -r requirements-dev.txt
# .PHONY:install-rust
# install-rust:
# @echo "Installing rust"
# curl https://sh.rustup.rs -sSf | sh -s -- -y
# @echo "Installing ic-cdk-optimizer"
# cargo install ic-cdk-optimizer
###########################################################################
# Llama2 model upload
# (-) The parent of this folder is added to Python path, for `python -m` to work
# (-) Everything else just works, because the upload script:
# -> uses model & tokenizer path are relative to itself
# -> pulls the canister information out of the network info (.dfx in icgpt repo)
.PHONY: upload-all-local
upload-all-local: upload-260K-local upload-15M-local upload-42M-local upload-110M-local
.PHONY: upload-all-ic
upload-all-ic: upload-260K-ic upload-15M-ic upload-42M-ic upload-110M-ic
.PHONY: upload-260K-local
upload-260K-local:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_260K set_canister_mode chat-principal --network local
@echo "---"
@echo "upload-260K-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network local --canister llama2_260K --model stories260K/stories260K.bin --tokenizer stories260K/tok512.bin
.PHONY: upload-15M-local
upload-15M-local:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_15M set_canister_mode chat-principal --network local
@echo "---"
@echo "upload-15M-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network local --canister llama2_15M --model models/stories15Mtok4096.bin --tokenizer tokenizers/tok4096.bin
.PHONY: upload-42M-local
upload-42M-local:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_42M set_canister_mode chat-principal --network local
@echo "---"
@echo "upload-42M-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network local --canister llama2_42M --model models/stories42M.bin --tokenizer tokenizers/tokenizer.bin
.PHONY: upload-charles-42M-local
upload-charles-42M-local:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_42M set_canister_mode chat-principal --network local
@echo "---"
@echo "upload-charles-42M-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network local --canister llama2_42M --model ../../charles/models/out-09/model.bin --tokenizer ../../charles/models/out-09/tok4096.bin
.PHONY: upload-110M-local
upload-110M-local:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_110M set_canister_mode chat-principal --network local
@echo "---"
@echo "upload-110M-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network local --canister llama2_110M --model models/stories110M.bin --tokenizer tokenizers/tokenizer.bin
.PHONY: upload-llama-cpp-qwen25-05b-q8-local
upload-llama-cpp-qwen25-05b-q8-local:
@echo "---"
@echo "upload-llama-cpp-qwen25-05b-q8-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ../../../onicai/repos/)"; \
python -m llama_cpp_canister.scripts.upload --network local --canister llama_cpp_qwen25_05b_q8 --canister-filename model.gguf models/Qwen/Qwen2.5-0.5B-Instruct-GGUF/qwen2.5-0.5b-instruct-q8_0.gguf
.PHONY: upload-260K-ic
upload-260K-ic:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_260K set_canister_mode chat-principal --network ic
@echo "---"
@echo "upload-260K-ic"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network ic --canister llama2_260K --model stories260K/stories260K.bin --tokenizer stories260K/tok512.bin
.PHONY: upload-15M-ic
upload-15M-ic:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_15M set_canister_mode chat-principal --network ic
@echo "---"
@echo "upload-15M-ic"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network ic --canister llama2_15M --model models/stories15Mtok4096.bin --tokenizer tokenizers/tok4096.bin
.PHONY: upload-42M-ic
upload-42M-ic:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_42M set_canister_mode chat-principal --network ic
@echo "---"
@echo "upload-42M-ic"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network ic --canister llama2_42M --model models/stories42M.bin --tokenizer tokenizers/tokenizer.bin
.PHONY: upload-charles-42M-ic
upload-charles-42M-ic:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_42M set_canister_mode chat-principal --network ic
@echo "---"
@echo "upload-charles-42M-ic"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network ic --canister llama2_42M --model ../../charles/models/out-09/model.bin --tokenizer ../../charles/models/out-09/tok4096.bin
.PHONY: upload-110M-ic
upload-110M-ic:
@echo "---"
@echo "Setting canister_mode to chat-principal"
dfx canister call llama2_110M set_canister_mode chat-principal --network ic
@echo "---"
@echo "upload-110M-local"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ..)"; \
python -m icpp_llm.llama2_c.scripts.upload --network ic --canister llama2_110M --model models/stories110M.bin --tokenizer tokenizers/tokenizer.bin
.PHONY: upload-llama-cpp-qwen25-05b-q8-ic
upload-llama-cpp-qwen25-05b-q8-ic:
@echo "---"
@echo "upload-llama-cpp-qwen25-05b-q8-ic"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ../../../onicai/repos/)"; \
python -m llama_cpp_canister.scripts.upload --network ic --canister llama_cpp_qwen25_05b_q8 --canister-filename model.gguf models/Qwen/Qwen2.5-0.5B-Instruct-GGUF/qwen2.5-0.5b-instruct-q8_0.gguf
.PHONY: download-log-llama-cpp-qwen25-05b-q8-ic
download-log-llama-cpp-qwen25-05b-q8-ic:
@echo "---"
@echo "download-log-llama-cpp-qwen25-05b-q8-ic"
export PYTHONPATH="${PYTHONPATH}:$(shell realpath ../../../onicai/repos/)"; \
python -m llama_cpp_canister.scripts.download --network ic --canister llama_cpp_qwen25_05b_q8 --local-filename main-llama-cpp-qwen25-05b-q8.log main.log