Python

fara-7b 모델 테스트

효진인데요 2025. 12. 1. 15:19


==========pc 성능=========

CPU: 11th Gen Intel(R) Core(tm) i7-11700k @ 3.60GHz

GPU: gpu0 NVIDIA GeForce RTX 3060

RAM: 32GB

Windows 버전: Windows 10 Pro

NPU 여부: x

SSD: C: 239GB/465GB    D: 3.51TB/3.63TB

 

 

 

============================깃허브 클론===========================

 

 

** wsl 환경에서 실행

 

git clone https://github.com/microsoft/fara.git
cd fara

 

 


==========가상환경 설정 및 패키지 설치=========

 

python -m venv venv
source .venv/bin/activate
pip install -e .
playwright install

 

 

========== VLLM 사용하여 모델 호스팅=========

 

vllm serve "microsoft/Fara-7B" --port 5000 --dtype auto

 

 

 


 

 

UI 활용하여 확인

 

# 1. 작업 폴더 mkdir + 이동 
mkdir fara_test && cd fara_test

# 2. Python virtual environment 만들기
python3 -m venv .venv
source .venv/bin/activate

# 3. Magentic-UI + fara extras 설치
pip install magentic-ui[fara]

# 4. 모델 서버 실행 (Self‑hosting with vLLM)
vllm serve "microsoft/Fara-7B" --port 5000 --dtype auto

# 5. Magentic‑UI 실행 & Fara 연결
magentic-ui --fara --port 8081 --config path/to/your/fara_config.yaml

 

 

==========* cuda 다운로드=========

 

python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

설치 후 아래 명령어 확인

 

python -c "import torch; print(torch.cuda.is_available())"

>> True로 리턴되면 GPU 사용 가능

 

===============* Transformers, Accelerate 설치==============

 

python -m pip install transformers accelerate

transformers : 모델 로딩용

accelerate : GPU 분산/자동 장치 맵핑 지원

 


==========* 테스트 파이썬 코드=========

# test_fara7b.py
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# 모델 이름
model_name = "microsoft/Fara-7B"

print("1️⃣ 토크나이저 로딩 중...")
tokenizer = AutoTokenizer.from_pretrained(model_name)

print("2️⃣ 모델 로딩 중 (GPU 자동 할당, float16)...")
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    device_map="auto",        # RTX 3060에 자동 배치
    torch_dtype=torch.float16 # VRAM 절약
)

print("3️⃣ 테스트 입력 준비...")
input_text = "안녕하세요, Fara-7B! 오늘 날씨 어때요?"
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")

print("4️⃣ 텍스트 생성 중...")
outputs = model.generate(
    **inputs,
    max_new_tokens=50,
    do_sample=True,
    temperature=0.7,
    top_p=0.9
)

generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("\n✅ Fara-7B 출력:\n", generated_text)

 

 

===============오류 발생===============

PS D:\Fara7B> & d:/Fara7B/fara7b_env/Scripts/Activate.ps1
(fara7b_env) PS D:\Fara7B> python .\test_fara7b.py
1️⃣ 토크나이저 로딩 중...
tokenizer_config.json: 4.73kB [00:00, ?B/s]
D:\Fara7B\fara7b_env\lib\site-packages\huggingface_hub\file_download.py:143: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\admin\.cache\huggingface\hub\models--microsoft--Fara-7B. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
  warnings.warn(message)
vocab.json: 2.78MB [00:00, 29.5MB/s]
merges.txt: 1.67MB [00:00, 28.3MB/s]
Xet Storage is enabled for this repo, but the 'hf_xet' package is not installed. Falling back to regular HTTP download. For better performance, install the package with: `pip install huggingface_hub[hf_xet]` or `pip install hf_xet`
tokenizer.json: 100%|█████████████████████████████████████████████████████████████████████████████████| 11.4M/11.4M [00:00<00:00, 11.6MB/s]
added_tokens.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 605/605 [00:00<?, ?B/s]
special_tokens_map.json: 100%|█████████████████████████████████████████████████████████████████████████████| 613/613 [00:00<00:00, 613kB/s]
chat_template.jinja: 1.02kB [00:00, 1.01MB/s]
2️⃣ 모델 로딩 중 (GPU 자동 할당, float16)...
config.json: 2.49kB [00:00, ?B/s]
`torch_dtype` is deprecated! Use `dtype` instead!
Traceback (most recent call last):
  File "D:\Fara7B\test_fara7b.py", line 12, in <module>
    model = AutoModelForCausalLM.from_pretrained(
  File "D:\Fara7B\fara7b_env\lib\site-packages\transformers\models\auto\auto_factory.py", line 607, in from_pretrained
    raise ValueError(
ValueError: Unrecognized configuration class <class 'transformers.models.qwen2_5_vl.configuration_qwen2_5_vl.Qwen2_5_VLConfig'> for this kind of AutoModel: AutoModelForCausalLM.
Model type should be one of ApertusConfig, ArceeConfig, Ari.....

 

>> " Fara‑7B 모델이 AutoModelForCausalLM에서 바로 로딩할 수 있는 일반적인 causal LM 타입이 아니다 "

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*참고

https://huggingface.co/microsoft/Fara-7B/discussions

 

microsoft/Fara-7B · Discussions

Improve model card: add paper badge, paper link, and sample usage

huggingface.co

 

https://news.hada.io/topic?id=24671

 

Fara-7B: 컴퓨터 사용을 위한 효율적인 에이전트형 모델 | GeekNews

Fara-7B는 70억 개의 파라미터로 구성된 초소형 에이전트형 언어 모델(SLM) 로, 웹 브라우저를 실제로 조작하며 작업을 수행하는 Computer Use Agent 구조마우스와 키보드 입력을 직접 예측해 시각적으로

news.hada.io

 

https://github.com/microsoft/fara

 

GitHub - microsoft/fara

Contribute to microsoft/fara development by creating an account on GitHub.

github.com

 

728x90