- runpod.ioμμ μ€ν
- Llama-7B μ¬μ©
- llama λͺ¨λΈμ workspace λ° νλλ μμ λ€μ΄λ°κΈ° λλ¬Έμ 컨ν μ΄λ μ©λμ 15GB μ λ μ‘μμ€μΌ νλ€
- Volume μ©λμ 30G μ΄μμΌλ‘ μ‘μμ€μΌ νλ€ - νμΈνλ λλκ³
outputμ μ μ₯λλ νμΌλ€μ΄ 25GB λ¨μ§λλ ν¬κΈ°κ° νμνκΈ° λλ¬Έ - νκΉ νμ΄μ€ λͺ¨λΈμ λ³λ λ€μ΄ λ°μ νμ μκ³
- A100 80G X 4λ‘ μ²μ μμ 1% μ§μ μμ μμμκ° 5:37:57 μ°ν
π―
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
| # /// script | |
| # dependencies = [ "transformers", "accelerate" ] | |
| # /// | |
| # run on 2xH200 rented from primeintellect.ai | |
| import gc | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer |
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
| # Frontend Design Guideline | |
| This document summarizes key frontend design principles and rules, showcasing | |
| recommended patterns. Follow these guidelines when writing frontend code. | |
| # Readability | |
| Improving the clarity and ease of understanding code. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 datetime import datetime | |
| import json | |
| import re | |
| import timeit | |
| from contextlib import contextmanager | |
| from dataclasses import dataclass | |
| from typing import Annotated, Any, Callable, Iterator, TypedDict | |
| from pydantic.annotated_handlers import GetJsonSchemaHandler |
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
| import "dotenv/config"; | |
| import { OpenAIEmbeddings } from "@langchain/openai"; | |
| import { TextLoader } from "langchain/document_loaders/fs/text"; | |
| import natural from "natural"; | |
| import * as math from "mathjs"; | |
| import { quantile } from "d3-array"; | |
| interface SentenceObject { | |
| sentence: string; | |
| index: number; |
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
| pub fn get_splade_vector( | |
| input: String, | |
| model: Model, | |
| tokenizer: &Tokenizer, | |
| ) -> Result<Vec<f32>, ServiceError> { | |
| let tokenized_inputs = tokenizer.encode(input, false).unwrap(); | |
| let tokens = tokenized_inputs.get_ids().to_vec(); | |
| let token_ids = Tensor::new(tokens.as_slice(), &candle_core::Device::Cpu) | |
| .map_err(|e| ServiceError::BadRequest(format!("Could not create tensor: {}", e)))?; |
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
| # Based on younesbelkada/finetune_llama_v2.py | |
| # Install the following libraries: | |
| # pip install accelerate==0.21.0 peft==0.4.0 bitsandbytes==0.40.2 transformers==4.31.0 trl==0.4.7 scipy | |
| from dataclasses import dataclass, field | |
| from typing import Optional | |
| import torch | |
| from datasets import load_dataset | |
| from transformers import ( |
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
| #!/bin/bash | |
| ### steps #### | |
| # verify the system has a cuda-capable gpu | |
| # download and install the nvidia cuda toolkit and cudnn | |
| # setup environmental variables | |
| # verify the installation | |
| ### | |
| ### to verify your gpu is cuda enable check |
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
| # 1) Install dependencies: pip install cohere datasets elasticsearch==8.6.2 | |
| # 2) Start a local Elasticsearch server: docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:8.6.2 | |
| # 3) Get your Cohere API key and past it below | |
| from elasticsearch import Elasticsearch, helpers | |
| import cohere | |
| from datasets import load_dataset | |
| # Get your cohere API key on: www.cohere.com |
NewerOlder