2024年2月21日 星期三

 build rustformers dockerfile

step 1: git clone https://github.com/rustformers/llm.git && git submodule update --init

step 2: cd llm && mv utils/Dockerfile .

step 3: modify dockerfile as shown below

 # Start with a rust alpine image

FROM rust:alpine3.19 as builder

# This is important, see https://github.com/rust-lang/docker-rust/issues/85

ENV RUSTFLAGS="-C target-feature=-crt-static"

# if needed, add additional dependencies here

RUN apk add --no-cache musl-dev pkgconfig openssl-dev

# set the workdir and copy the source into it

WORKDIR /app

COPY ./ /app

# do a release build

RUN cargo build --release --bin llm

RUN strip target/release/llm

step 4:  docker build -t rustformers:v1 .



 untimeError: cutlassF: no kernel found to launch!

Try to add

torch.backends.cuda.enable_mem_efficient_sdp(False)
torch.backends.cuda.enable_flash_sdp(False)

reference:

https://huggingface.co/stabilityai/stable-cascade/discussions/11

2023年9月19日 星期二

MOJO install in WSL

WSL ubuntu_22.04

conda create -n mojo python=3.10

conda activate mojo

sudo apt-get install -y apt-transport-https &&

  keyring_location=/usr/share/keyrings/modular-installer-archive-keyring.gpg &&

  curl -1sLf 'https://dl.modular.com/bBNWiLZX5igwHXeu/installer/gpg.0E4925737A3895AD.key' |  gpg --dearmor | sudo tee ${keyring_location} &&

  curl -1sLf 'https://dl.modular.com/bBNWiLZX5igwHXeu/installer/config.deb.txt?distro=debian&codename=wheezy' | sudo tee /etc/apt/sources.list.d/modular-installer.list &&

 sudo apt-get update &&

 sudo apt-get install -y modular

modular auth mut_f515f73db5154dfb8ab8d0148513938e &&

modular install mojo

echo 'export MODULAR_HOME="/home/user/.modular"' >> ~/.bashrc

echo 'export PATH="/home/user/.modular/pkg/packages.modular.com_mojo/bin:$PATH"' >> ~/.bashrc

source ~/.bashrc

mojo

Welcome to Mojo! 🔥

Expressions are delimited by a blank line.

Type `:mojo help` for further assistance.

1>

it's work ^^

source: https://github.com/modularml/mojo/issues/607

2022年11月2日 星期三

需求:在docker container 中可以run docker

 docker in docker

docker run --name my_dind --privileged -d -p5555:22 -p 8888:8888 docker:dind


set ssh server on alpine

apk search openssh

apk add openssh

rc-update add sshd


rc-status

/etc/init.d/sshd restat

ssh users@0.0.0.0 -p5555

scp -P 5555 .\hello.py user@0.0.0.0:/home/user


FROM alpine:3.1

RUN apk add --update make cmake gcc g++ gfortran
RUN apk add --update python py-pip python-dev
RUN pip install cython
RUN pip install numpy



reference

https://docs.gitlab.com/ee/ci/docker/using_docker_build.html

https://www.cyberciti.biz/faq/how-to-install-openssh-server-on-alpine-linux-including-docker/

https://wiki.alpinelinux.org/wiki/Setting_up_a_SSH_server

2021年4月27日 星期二

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. 
Make sure that the latest NVIDIA driver is installed and running.


移除nvidia驅動

sudo apt-get remove --purge '^nvidia-.*'

sudo apt-update

安裝驅動

sudo ubuntu-drivers autoinstall

安裝linux-headers

sudo apt install linux-headers-$(uname -r)

2019年1月8日 星期二

install dynet on mac

first, install Eigen3

brew install cmake hg
hg clone https://bitbucket.org/eigen/eigen/ -r b2e267d
brew install --HEAD eigen


cd dynet
mkdir build
cd build

cmake .. -DEIGEN3_INCLUDE_DIR=/usr/local/cellar/eigen/3.3.4/include/eigen3 -DENABLE_CPP_EXAMPLES=ON
make -j4
then error
/usr/local/Cellar/eigen/3.3.4/include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h:39:7: error: 
      class template partial specialization is not more specialized than the

      primary template [-Winvalid-partial-specialization]

set the following information in  CMakeLists.txt line 84

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization")

make -j4

done
# Test with an example
./examples/xor
Reference:

https://github.com/clab/dynet#installation
https://github.com/zou3519/pytorch/commit/6ba96952a6c7b9a6a495f333427c15c7ba18fa22

2018年1月8日 星期一

Proxy


add-apt-repository-wont-work-on-proxy

$ sudo vim /etc/apt/apt.conf

Acquire::http::proxy "http://localhost:9999";
Acquire::ftp::proxy "ftp://localhost:9999";
Acquire::https::proxy "https://localhost:9999";

sudo visudo
then add the following lines
Defaults env_keep="http_proxy"
Defaults env_keep="https_proxy"
then:
sudo bash
export https_proxy=http://[username:password@]www.proxy.com:8000/
add-apt-repository ppa:


sudo -E add-apt-repository ppa:webupd8team/java

conda proxy

put .condarc file in home folder
proxy_servers:
    http: http://user:pass@corp.com:8080
    https: https://user:pass@corp.com:8080

git proxy

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

docker proxy
Creating Proxy Configuration
  1. Create a new directory for our Docker service configurations.
    sudo mkdir -p /etc/systemd/system/docker.service.d
  2. Create a file called proxy.conf in our configuration directory.
    sudo vi /etc/systemd/system/docker.service.d/proxy.conf
  3. Add the following contents, changing the values to match your environment.
    [Service]
    Environment="HTTP_PROXY=http://myproxy.hostname:8080"
    Environment="HTTPS_PROXY=https://myproxy.hostname:8080/"
    Environment="NO_PROXY=localhost,127.0.0.1,::1"
  4. Save your changes and exit the text editor.
  5. Reload the daemon configuration.
    sudo systemctl daemon-reload
  6. Restart Docker to apply our changes.
    sudo systemctl restart docker.service
Set transformers, sentencetransformers download model proxy
import os
os.environ['http_proxy']='your proxy'
os.environ['https_proxy']='your proxy'

在公司環境下使用GOlang with VSCODE設置 Proxy(CMD 或 PowerShell 擇一)


1、(與下擇一)使用管理者權限的 CMD 改 proxy 環境變數
> go env -w GOPROXY=https://proxy.golang.org,direct
> setx http_proxy http://xx.xx.xx.88:8080
> setx https_proxy http://xx.xx.xx.88:8080


1、(與上擇一)使用管理者權限的 Powershell 改 proxy 環境變數
> go env -w GOPROXY=https://proxy.golang.org,direct
> [Environment]::SetEnvironmentVariable("http_proxy", "http://xx.xx.xx.88:8080", 'User')
> [Environment]::SetEnvironmentVariable("https_proxy", "http://xx.xx.xx.88:8080", 'User')


2、最後要將 Visual Studio Code 重新開啟


Reference:
https://askubuntu.com/questions/92464/add-apt-repository-wont-work-on-proxy
https://stackoverflow.com/questions/31099279/running-conda-with-proxy
https://stackoverflow.com/questions/783811/getting-git-to-work-with-a-proxy-server
https://www.serverlab.ca/tutorials/containers/docker/how-to-set-the-proxy-for-docker-on-ubuntu/
https://docs.docker.com/config/daemon/systemd/
https://stackoverflow.com/questions/65913053/how-to-set-proxy-in-sentencetransformers