Comments (1)
you can simply use HF pipeline like this:
import torch
from transformers import pipeline, AutoModelForCausalLM
MODEL = 'beomi/KoAlpaca-Polyglot-5.8B'
model = AutoModelForCausalLM.from_pretrained(
MODEL,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
).to(device=f"cuda", non_blocking=True)
model.eval()
pipe = pipeline(
'text-generation',
model=model,
tokenizer=MODEL,
device=0
)
def ask(x, context='', is_input_full=False):
ans = pipe(
f"### 질문: {x}\n\n### 맥락: {context}\n\n### 답변:" if context else f"### 질문: {x}\n\n### 답변:",
do_sample=True,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
return_full_text=False,
eos_token_id=2,
)
print(ans[0]['generated_text'])
ask("딥러닝이 뭐야?")
# 딥러닝은 인공신경망을 통해 입력과 출력 사이의 복잡한 관계를 학습하는 머신러닝의 한 분야입니다. 이 기술은 컴퓨터가 인간의 학습 능력과 유사한 방식으로 패턴을 학습하도록 하며, 인간의 개입 없이도 데이터를 처리할 수 있는 기술입니다. 최근에는 딥러닝을 활용한 인공지능 애플리케이션이 많이 개발되고 있습니다. 예를 들어, 의료 진단 애플리케이션에서는 딥러닝 기술을 활용하여 환자의 특징을 파악하고, 이를 통해 빠르고 정확한 진단을 내리는 데 사용됩니다. 또한, 금융 분야에서는 딥러닝 기술을 활용하여 주가 예측 모형을 학습하는 데 사용되기도 합니다.
Note: You'll need >=24GB of Vram GPU to run with float16
from koalpaca.
Related Issues (20)
- LLaMa 30B, 65B token은 7B token 그대로 써도 되는건가요?? HOT 1
- 허깅 페이스의 TGI 이미지로 KoAlpaca-Polyglot-12.8B docker 컨테이너 생성하려고 하는데 오류가 발생됩니다. HOT 1
- chat-ui description 수정 HOT 1
- PEFT로LoRA로드 중에 에러
- decapoda-research/llama-13b-hf 모델이 사라졌습니다. HOT 1
- 학습한 LLM 모델이 말을 끝내지 않고 계속 생성합니다. HOT 5
- KoAlpaca polyglot 12.8b Fine-tuning 시 에러문의 드립니다. HOT 2
- KoAlpaca 모델 실행 예시코드 실행 중 용량 초과로 취소된 문제에 대해 문의드려요.
- ko-alpaca 1.0 데이터셋 관련 문의
- Few-shot 평가 문의
- index.json 파일 문의 드립니다 HOT 1
- beomi/KoAlpaca-Polyglot-12.8B 로 inference를 진행하기 위해서는 48GB의 VRAM이 필요한가요? HOT 3
- prompt 관련 ko_alpaca_data.json 형식 문의 드립니다. HOT 1
- 학습 결과 inference시 질문좀 드리겠습니다.! HOT 3
- 모델 저장 및 허깅페이스에 올리는법..이것때문에 문제가 생기네요 ㅠㅠ HOT 1
- 원하는 형태의 답변으로 고정시킬 수 있는 방법이 있을까요? HOT 4
- NSMC 결과 reproducing HOT 1
- 상업적 이용 가능 여부 관련 HOT 2
- 데모에 성능에 대해 질문있습니다. HOT 1
- Citation 관련 문의드립니다
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koalpaca.