Текущая настройка:
приложение Android с Chaquopy
Python 3.8
Пытаюсь использовать Qwen2 -0.5B-Модель инструкций
Конфигурация Gradle:
Код: Выделить всё
gradleCopypython {
version "3.8"
pip {
install "torch==1.8.1"
install "numpy"
install "transformers==4.41.2"
install "safetensors==0.3.1"
install "tokenizers==0.10.3"
}
}
Код: Выделить всё
pythonCopyfrom transformers import AutoTokenizer, AutoModelForCausalLM
checkpoint = "model_files/Qwen2-0.5B-Instruct"
def initialize_model():
global tokenizer, model
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint)
def interpret_text(text):
if tokenizer is None or model is None:
initialize_model()
inputs = tokenizer.encode(text, return_tensors="pt")
outputs = model.generate(inputs, max_length=50)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
Конфликты зависимостей между преобразователями, токенизаторами и упаковкой
Последняя ошибка: InvalidVersion: Неверная версия: '0.10.1,
Подробнее здесь: https://stackoverflow.com/questions/788 ... ruct-model