405 : Client Error: Not Allowed for huggingface url - huggingface-transformers

I am trying to follow the huggingface tutorial on finetuning models for summarization.
All I'm trying is to load the t5 tokenizer.
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("t5-small")
And I get the following error:
...
...
Please help. Thank you.

This solved the issue for me. You can add
import os
os.environ['TRANSFORMERS_OFFLINE'] = 'yes'
Quoting sgugger from here.
No that’s not a bug, the method tries to detect if a more recent version of the model is available, which is why it connects to the repo. To work fully offline, you need to set the environment variable TRANSFORMERS_OFFLINE to 1 or yes (see here 313).

Related

What's the best way to reload python query module during development?

I'm working on my first query module for Memgraph. I'm trying to find the best approach.
I have a query module that depends on a local submodule (firstone):
import firstone
import mgp
import importlib
#mgp.read_proc
def procedure(context...):
importlib.reload(firstone)
firstone.call()
If I get it correctly, if firstone module changes, the procedure is still using the previous code. How can I reload the Python query module during development?
You can use the use mg.load to load or reload the given module. The correct syntax is CALL mg.load("py_example");. After loading the module, all dependent Python's submodules that are imported will also be reloaded. The official documentation can be found on Memgraph site.

how to import and use Pear XML serializer in Laravel project

I am trying to use Pear XMLSerializer package ina Laravel project.
I have included the in composer.json and did composer install and composer update.
Now how to i call it and use it in a class - what use statement I should use at top of class to use it in the class?
Thanks
I spent a quite long time in order to get it work, but I couldn't, I found "StreamParser", It gave me the same functionality, https://laravel-news.com/php-7-multi-format-streaming-parser. hopefully, it will help you.

Laravel mailChimp package error

I try to use the package https://github.com/BlueBayTravel/Mailchimp as in examples but i got an error:
ErrorException in Mailchimp.php line 64:
Undefined property: BlueBayTravel\Mailchimp\Facades\Mailchimp::$users
when i try to use: Mailchimp::users(), while i can get a connection via Mailchimp::getDefaultConnection(); mean the package is completely red, what u guess the problem with me here ?
I saw that you already opened an issue in the package repo.
If you are using Laravel, and you want to use an existing integration with Mailchimp, I would recommend you to give a try to the spatie/laravel-newsletter package. It's the most complete package I've found for the integration Laravel + Mailchimp, and it uses the drewm/mailchimp-api API wrapper (which IMO, is the best php wrapper for Mailchimp). You can find some examples at Freek's blog or at the README file of the project. And if you do not find what you need, you can go to a lower level using the drewm wrapper: $api = Newsletter::getApi();
If this is not what you are looking for, you can always create your own service in Laravel, adapted to your needs and requierements ;)

Get post save event in Odoo

I want to execute a function after some record is saved in the database (something like Signals in Django).
I have tried using Odoo Connector but with no success. connector module is not present in openerp.addons package by default and I could not find a good resource to understand how to install it.
How can I execute a function every time a new record is saved?
I solved it myself.
I manually copied connector module from github to /usr/lib/python2.7/dist-packages/openerp/addons (to make sure it's in my IDE's libraries' path).
Installed the connector from Settings -> Local Modules.
Used the following code (can be anywhere, even in __init__.py of your module)
#on_record_create(model_names=['res.users', 'res.partner'])
#on_record_write(model_names=['res.users', 'res.partner'])
def delay_export(session, model_name, record_id, vals):
"""
Do some real work here.
"""
import ipdb; ipdb.set_trace()
The above code is based on odoo-connector.

Get uRapidFlow logs for an import profile batch

I am running a php script using a cron job to run a uRapidFlow / RapidFlow import profile. Here is the documented code I found to help me do this.
I need to be able to run through the imported batch, row by row, and do some processing based on if the row was imported successfully or not. It would also be very convenient and useful to be able to send email notifications on failed imports in general as well. If anyone has any idea, or can point me in the right direction, I would be very grateful. I don't see any documentation for this online, so I am going through the module code and database trying to figure it out myself.
I am using Magento EE 1.12.0.2
The best bet, unless you modify the uRapidFlow extension (check license information before doing so). Would be to extend it and use a observed event.
Try the observer : catalog_product_import_finish_before Which is triggered after each product is imported. Bare in mind this solution would be triggered globably for any manual imports, so if you build a small extension, perhaps make it easy to toggle on and off.
More can be found on Magento's observers here : http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
Note as you've not specified which version of Magento you are using, you'll have to check if that observer is supported in your version.

Resources