Skip to content

YoungHaKim7/Machine_Learning_Rust

Repository files navigation

link


최신뉴스


ollama 쓸만한거

# 4.7GB
ollama run llama3.1

# 26GB
ollama run mixtral:8x7b

# 39GB
ollama run llama3.1:70b

# 79GB
ollama run mixtral:8x22b

(C++코드로 머신러닝 잘 설명됨.)Snake learns with NEUROEVOLUTION (implementing NEAT from scratch in C++) |Tech With Nikola


1bit에 집중하자 NVIDIA도 이제 끝이네

Blackwell Hopper
Supported Tensor Core precisions FP64, TF32, BF16, FP16, FP8, INT8, FP6, FP4 FP64, TF32, BF16, FP16, FP8, INT8
Supported CUDA* Core precisions FP64, FP32, FP16, BF16 FP64, FP32, FP16, BF16, INT8

NVIDIA칩 자세히 알아보기(240617)

NVIDIA는 16-bit Float(FP16/BF16) 부동 소수점에 최적화 되어있어서

  • 완전히 다른 방식으로 접근하고 있다.
    • Develop optimized kernels for 1-bit operations
    • Use FPGAs or ASICs for 1-bit operations

BitNet b1.58(This Work). vs 16-bit Float(FP16/BF16)

  • 9min 46s 참고

Why BitNet b1.58?

  • Each cell only three values:
    • { -1, 0 ,1 }
    • How many bits are needed to differentiate three equally likely states?

$$Log_2(3) = 1.58$$

(24년 04월경쯤)GN⁺: 1비트 LLM 시대: 비용 효율적인 컴퓨팅을 위한 삼진 파라미터 (arxiv.org)


초보자를 위한 Vector Embeddings 가이드 (timescale.com)

  • https://news.hada.io/topic?id=15094&utm_source=weekly&utm_medium=email&utm_campaign=202423

    • 26P by xguru 24.05.31.
  • 벡터 임베딩의 종류

    • 단어 임베딩: NLP에서 단어를 표현하며, 단어 간의 의미적 관계를 캡처함. 언어 번역, 단어 유사성, 감정 분석 등에 사용됨.
    • 문장 임베딩: 문장의 의미와 문맥을 캡처하며, 정보 검색, 텍스트 분류, 감정 분석 등에 사용됨.
    • 문서 임베딩: 보고서나 기사 같은 문서의 내용을 캡처하며, 추천 시스템, 정보 검색, 문서 유사성 및 분류 등에 사용됨.
    • 그래프 임베딩: 그래프의 노드와 엣지를 벡터 공간에 표현하며, 노드 분류, 커뮤니티 인식, 링크 예측 등에 사용됨.
    • 이미지 임베딩: 이미지의 다양한 측면을 표현하며, 콘텐츠 기반 추천 시스템, 이미지 및 객체 인식, 이미지 검색 시스템 등에 사용됨.
    • 제품 임베딩: 디지털 제품이나 물리적 제품을 표현하며, 제품 추천 및 분류 시스템, 제품 검색 등에 사용됨.
    • 오디오 임베딩: 오디오 신호의 리듬, 톤, 피치 등을 표현하며, 감정 감지, 음성 인식, 음악 추천 등에 사용됨.
  • 신경망이 임베딩을 생성하는 방법

    • 표현 학습: 신경망이 고차원 데이터를 저차원 공간으로 매핑하여 중요한 특성을 보존함.
    • 훈련 과정: 신경망이 데이터를 의미 있는 임베딩으로 변환하도록 학습함. 이는 뉴런의 가중치와 바이어스를 조정하는 과정에서 이루어짐.
    • 예시: 영화 리뷰의 긍정/부정 분류를 위한 신경망에서 단어 임베딩이 학습됨. "good"과 "excellent" 같은 단어는 유사한 임베딩을 가지게 됨.
  • 벡터 임베딩의 작동 원리

    • 벡터 공간: 객체나 특징을 다차원 벡터 공간의 점으로 표현하며, 유사한 항목은 가까이 위치함.
    • 거리 측정: 유클리드 거리, 코사인 유사도 등을 사용하여 벡터 간의 관계를 정량화함.
    • 예시: "cat"과 "dog"의 벡터는 "cat"과 "car"의 벡터보다 더 가까이 위치함.
  • 벡터 임베딩을 활용한 개발

    • 챗봇: 사용자 쿼리에 더 잘 응답하고, 문맥적으로 관련된 응답을 생성하며, 일관된 대화를 유지함.
    • 시맨틱 검색 엔진: 키워드 매칭 대신 의미적 유사성에 기반한 검색 결과를 제공함.
    • 텍스트 분류 시스템: 문서를 구문과 단어에 따라 분류함.
    • 추천 시스템: 키워드와 설명의 유사성에 따라 콘텐츠를 추천함.
  • 데이터에 대한 벡터 임베딩 생성 방법

    • 데이터 수집: 텍스트, 오디오, 이미지, 시계열 데이터 등 다양한 데이터를 수집함.
    • 데이터 전처리: 토큰화, 노이즈 제거, 이미지 크기 조정, 정규화 등 데이터를 분석에 적합하게 처리함.
    • 데이터 분할: 텍스트를 문장이나 단어로, 이미지를 세그먼트로, 시계열 데이터를 간격으로 나눔.
    • 벡터화: 각 데이터 조각을 벡터로 변환함. 텍스트 데이터는 OpenAI의 텍스트 임베딩 모델, 이미지 데이터는 CNN 모델, 오디오 데이터는 스펙트로그램 등을 사용함.
  • 벡터 임베딩 저장 방법

    • 벡터 데이터베이스: 벡터 데이터를 효율적으로 저장하고 검색할 수 있는 데이터베이스 사용.
    • PostgreSQL: 벡터 데이터를 다른 관계형 데이터와 함께 저장할 수 있음. pgvector 확장을 사용하여 벡터를 저장하고 쿼리할 수 있음.
  • 그 외에 좋은글



역시 갓 c언어

  • llm.c, 이제 멀티GPU 트레이닝을 지원하며 PyTorch보다 ~7% 빠름
  • Andrej Karpathy가 순수 C/CUDA로 만든 간단한 LLM 훈련 코드
  • 이제 멀티 GPU 트레이닝을 bfloat16으로 Flash Attention과 함께 수행
  • ~3000 라인의 C/CUDA 코드로 구현되었으며, 전반적으로 PyTorch보다 7% 정도까지 빠름
  • 지금까지 작업한 내용들
    • 혼합 정밀도 훈련(bfloat16)
    • 정규화된...

파이토치 bye bye 👋 존나게 구린 파이토치 ㅋㅋㅋ 그동안 참고 쓰느라 힘들었다 ㅋㅋ 더럽고 치사해서 더 공부해서 러스트로 만들어 보자 ㅋㅋ

바로 해봐야지


MachineLearning_Tutorial


LLM -> LMM으로 패러다임 전환 중~~


Jupyter 노트북 러스트로 빠르게 돌리기

$ cargo install --locked evcxr_jupyter
  • Then, use its binary to automatically install it inside Jupyter:
$ evcxr_jupyter --install

Rust+WASM으로 이기종 Edge에서 빠르고 포터블한 Llama2 추론 실행하기 (secondstate.io)


m1 macOS pytorch install

https://pytorch.org/get-started/locally/


h2oGPT - 완전한 오픈소스 GPT (github.com/h2oai)

llama2를 파인 튜닝 하고 있는 사람들

JS강의 No Black Box Machine Learning Course – Learn Without Libraries

https://youtu.be/vDDjtwQDw2k?si=exYH6L2aHAYEqGTJ


AlphaGo - The Movie | Full award-winning documentary

https://youtu.be/WXuK6gekU1Y?si=D9ZPN7Lxc6icN2g9


Building a neural network FROM SCRATCH (no Tensorflow/Pytorch, just numpy & math)

  • C언어로 Tesorflow/Pythorch 라이브러리 안 쓰고 신경망 구축하기 꼭 해보자❤

https://youtu.be/w8yWXqWQYmU


신경망 수학 그림으로 다 이해하기 - 복잡한 신경망도 다 이해된다 !!! 최고Why Neural Networks can learn (almost) anything | Emergent Garden

https://youtu.be/0QczhVg5HaI


Run LLaMA inference on CPU, with Rust 🦀🚀🦙

Artificial_Intelligence(NLP, Natural Language Processing models and pipelines.)

Rust MachineLearningrustmascot

dfdx: shape checked deep learning in rust

Minimalist ML framework for Rust

https://github.com/huggingface/candle



Dalai - Automatically install, run, and play with LLaMA on your computer

  • What is Dalai?

It lets you one-click install LLaMA on your machine. No need to bother building cpp files, cloning GitHub, and downloading files and stuff. Everything is automated. Dalai is a tool in the Large Language Model Tools category of a tech stack. Dalai is an open source tool with GitHub stars and GitHub forks. Here’s a link to Dalai's open source repository on GitHub

https://cocktailpeanut.github.io/dalai/#/

https://stackshare.io/dalai?utm_source=weekly_digest&utm_medium=email&utm_campaign=03292023&utm_content=new_tool

  • 한국에 누군가 올린 게시판 글

https://www.ddengle.com/board_free/19129866

The Pile is a large, diverse, open source language modelling data set

https://github.com/EleutherAI/the-pile


brew install libtorch(macOS)

  • pytorch 실행전 이거 먼저 실행할 것 !!!
export LIBTORCH='/opt/homebrew/Cellar/pytorch/1.13.1'

export LD_LIBRARY_PATH=$LIBTORCH:$LD_LIBRARY_PATH


echo $LD_LIBRARY_PATH
/opt/homebrew/Cellar/pytorch/1.13.1:

Rust Artificial Intelligence (The Simple Way)

https://youtu.be/StMP7g-0wK4

https://github.com/guillaume-be/rust-bert


The AI community building the future.

https://huggingface.co/



How to Build a Machine Learning Model in Rust

https://www.freecodecamp.org/news/how-to-build-a-machine-learning-model-in-rust/

Rust Machine Learning Book

https://rust-ml.github.io/book/chapter_1.html


Unicode (Vim Plug-in)

https://github.com/chrisbra/unicode.vim

  • Ex commands:
:UnicodeTable    - Print Unicode Table in new window
:Digraphs        - Search for specific digraph char
:UnicodeSearch   - Search for specific unicode char
:UnicodeSearch!  - Search for specific unicode char (and add at current cursor position)
:UnicodeName     - Identify character under cursor (like ga command)
:DownloadUnicode - Download (or update) Unicode data
:UnicodeCache    - Create cache file


  • Normal mode commands:

<C-X><C-G>  - Complete Digraph char
<C-X><C-Z>  - Complete Unicode char
<F4>        - Combine characters into digraphs
Scripting Functions:
unicode#FindUnicodeBy() - Find unicode characters
unicode#FindDigraphBy() - Find Digraph char
unicode#Digraph()       - Returns digraph char
unicode#UnicodeName()   - Identifies unicode character (by value)

Natural Language Processing for Rust

https://github.com/lexi-sh/rs-natural



This repository is a list of machine learning libraries written in Rust. It's a compilation of GitHub repositories, blogs, books, movies, discussions, papers, etc. 🦀

https://github.com/vaaaaanquish/Awesome-Rust-MachineLearning



Here is an example of a simple machine learning program written in the Rust programming language:

  • GPT3

https://chat.openai.com/chat

This program sets up a game context and creates a new MainState struct to hold the game's state. It then runs the game loop, which handles events and updates the game state accordingly. The MainState struct and its associated methods and the event handling methods can be customized to implement the specific game logic and mechanics.


use ndarray::{Array, Array2};
use rand::{thread_rng, Rng};
use rusty_machine::linalg::{Matrix, Vector};
use rusty_machine::learning::k_means::KMeansClassifier;
use rusty_machine::learning::UnSupModel;

// Create some random data to cluster
let mut rng = thread_rng();
let data: Vec<Vector<f64>> = (0..100)
    .map(|_| Vector::new(vec![rng.gen(), rng.gen()]))
    .collect();
let data = Matrix::new(100, 2, data);

// Create a new k-means model with 2 clusters
let mut model = KMeansClassifier::new(2);

// Train the model on the data
model.train(&data)?;

// Predict the cluster assignments for the data
let assignments = model.predict(&data)?;

// Print the cluster assignments
println!("Cluster assignments: {:?}", assignments);
This program creates some random data and uses the KMeansClassifier type from the rusty_machine crate to train a k-means clustering model on the data. It then uses the trained model to predict the cluster assignments for the data and prints the results. The KMeansClassifier type and the train and predict methods can be customized to implement different machine learning algorithms and apply them to different types of data.




  • 은근히 코드 안 맞는다. ㅋ

https://athemathmo.github.io/rusty-machine/doc/rusty_machine/index.html



How to Build a Machine Learning Model in Rust

https://www.freecodecamp.org/news/how-to-build-a-machine-learning-model-in-rust/


Machine_Learning_Rust

머신러닝기초

About

Machine_Learning_Rust & My Youtube Channel - GlobalYoung https://www.youtube.com/@GlobalYoung7

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages