Download URLs:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from transformers import AutoModel | |
| import torch | |
| model_path = "./my_downloaded_model" | |
| model = AutoModel.from_pretrained(model_path, local_files_only=True) | |
| total_params = sum(p.numel() for p in model.parameters()) | |
| trainable_params = sum(p.numel() for p in model.parameters() if p.requires_grad) | |
| print(f"Total parameters: {total_params}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| function kill_tree { | |
| local pid=$1 | |
| local children=$(pgrep -P $pid) | |
| for child in $children; do | |
| kill_tree $child | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| "sync" | |
| "time" | |
| ) | |
| func main() { |
Reference: https://github.com/intel/linux-npu-driver/releases/tag/v1.8.0
First we need to install the NPU drivers.
-
Ubuntu 24.04
# 1. wget all the driver deb packages wget https://github.com/intel/linux-npu-driver/releases/download/v1.8.0/intel-driver-compiler-npu_1.8.0.20240916-10885588273_ubuntu24.04_amd64.deb wget https://github.com/intel/linux-npu-driver/releases/download/v1.8.0/intel-fw-npu_1.8.0.20240916-10885588273_ubuntu24.04_amd64.deb
参考链接:
Cron 语法由 5 个字段组成,从左到右分别是:
- 分钟(0-59)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| var m = map[int]map[int]struct{}{ | |
| 1: {2: struct{}{}}, | |
| } | |
| func main() { | |
| for _, item := range [][2]int{ | |
| {1, 2}, | |
| {1, 3}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| func printN(n int, prev <-chan struct{}, next chan<- struct{}) { | |
| <-prev // wait for the previous signal | |
| println(n) | |
| next <- struct{}{} // activate the next goroutine | |
| } | |
| func printAll(n int) { | |
| if n < 1 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // PIMPL | |
| #include <iostream> | |
| #include <string> | |
| template <typename T> | |
| class Pimpl { | |
| protected: | |
| T *const impl; | |
| public: | |
| Pimpl(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Example program | |
| #include <iostream> | |
| #include <memory> | |
| #include <string> | |
| using std::cout; | |
| using std::endl; | |
| using std::make_unique; | |
| using std::unique_ptr; |
NewerOlder