Skip to content

Instantly share code, notes, and snippets.

@j40903272
j40903272 / vllm_cu11.8
Created April 26, 2024 05:25
# Install vLLM with CUDA 11.8.
conda create -n vllm python=3.10
conda activate vllm
export VLLM_VERSION=0.4.0
export PYTHON_VERSION=310
pip install https://github.com/vllm-project/vllm/releases/download/v${VLLM_VERSION}/vllm-${VLLM_VERSION}+cu118-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}-manylinux1_x86_64.whl
# Re-install PyTorch with CUDA 11.8.
pip uninstall torch -y
pip install torch==2.1.2+cu118 --index-url https://download.pytorch.org/whl/cu118
@j40903272
j40903272 / wikipedia_entity_search.py
Created March 6, 2024 16:27
Wikipedia entity search
import requests
import numpy as np
from collections import Counter
#from googlesearch import search as google_search
import wikipedia as wikipedia_api
DEFAULT_IGNORED_NS = ('wikipedia:', 'file:', 'portal:', 'template:', 'mediawiki:', 'user:',
'help:', 'book:', 'draft:', 'module:', 'timedtext:')
@j40903272
j40903272 / llama2_example.py
Created September 5, 2023 05:31
llama-2-13b-chat-transformers
import os
import sys
import time
from typing import List
import logging
import shortuuid
from vllm import AsyncEngineArgs, AsyncLLMEngine, SamplingParams
@j40903272
j40903272 / papergpt.ipynb
Created June 18, 2023 02:12
research paper editor
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from typing import Optional, Union, List, Dict, Tuple
from pydantic import Field
import ast
import astunparse
import logging
import pandas as pd
from langchain.utilities import GoogleSearchAPIWrapper
from langchain.tools import Tool
from langchain.python import PythonREPL
from langchain.tools.base import BaseTool
import re
import json
import logging
import threading
from typing import Union
from abc import ABC, abstractmethod
from langchain.chains.conversation.memory import (
ConversationBufferMemory,
# ConversationBufferWindowMemory,
import time
import requests
import logging
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'Content-Type': 'application/json',
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
@j40903272
j40903272 / telegram_util.py
Last active May 27, 2022 08:00
telegram exmaple
import json
import requests
import telegram
from telethon import TelegramClient, sync
============================================================================================================
msg = {
"symbol": "BTC",
"action": "BUY",
@j40903272
j40903272 / evaluation.py
Created February 10, 2022 05:00
riusbot 近期績效整理
#!/usr/bin/env python
# coding: utf-8
# In[59]:
import pdb
import time
import pickle
import ccxt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.