Coder Social home page Coder Social logo

Comments (6)

philschmid avatar philschmid commented on June 12, 2024

Hello @KartikKannapur,

Thank you for opening the issue. The snippet ist current not up to date regarding the versions. Could you try with transformers version 4.26?

from sagemaker-huggingface-inference-toolkit.

KartikKannapur avatar KartikKannapur commented on June 12, 2024

Hey @philschmid

Thank you for looking into this.

I updated the transformers version to 4.26
The SageMaker SDK version is 2.132.0

and I received the following error message

ValueError: Unsupported huggingface version: 4.26.0. You may need to upgrade your SDK version (pip install -U sagemaker) for newer huggingface versions. Supported huggingface version(s): 4.6.1, 4.10.2, 4.11.0, 4.12.3, 4.17.0, 4.6, 4.10, 4.11, 4.12, 4.17.

So, I updated the SageMaker SDK to version 2.140.1
and when I ran the predictor.predict for model inference, I ran into the same error as before.

Any suggestions?

from sagemaker-huggingface-inference-toolkit.

philschmid avatar philschmid commented on June 12, 2024

Could you share your code how you deployed? i will try to reproduce it then.

from sagemaker-huggingface-inference-toolkit.

KartikKannapur avatar KartikKannapur commented on June 12, 2024
from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
	'HF_MODEL_ID':'allenai/cosmo-xl',
	'HF_TASK':'conversational'
}

# create Hugging Face Model Class
huggingface_model = HuggingFaceModel(
	transformers_version='4.26.0',
	pytorch_version='1.13.1',
	py_version='py39',
	env=hub,
	role=role, 
)

# deploy model to SageMaker Inference
predictor = huggingface_model.deploy(
	initial_instance_count=1, # number of instances
	instance_type='ml.m5.xlarge' # ec2 instance type
)

predictor.predict({
	'inputs': {
		"past_user_inputs": ["Which movie is the best ?"],
		"generated_responses": ["It's Die Hard for sure."],
		"text": "Can you explain why ?"
	}
})

Thanks @philschmid
Appreciate your support on this.

from sagemaker-huggingface-inference-toolkit.

philschmid avatar philschmid commented on June 12, 2024

Ah i see. the task conversation is not correct here. Not sure why they added it manually. Can you switch the task to text2text-generation? then it should work.

Also from reading the model card: https://huggingface.co/allenai/cosmo-xl#how-to-use it might make sense if you create a custom infernece.py to get the "conversational" flow in to the generation method.

from sagemaker-huggingface-inference-toolkit.

KartikKannapur avatar KartikKannapur commented on June 12, 2024

Understood. Thanks @philschmid

I'm going to go the custom inference.py route.

from sagemaker-huggingface-inference-toolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.