Why do I get the error "ModuleNotFoundError: No module named 'huggan'"? - huggingface-transformers

I am trying to implement this model from HuggingFace🤗. To run the model I need to import HugGANModelHubMixin with:
from huggan.pytorch.huggan_mixin import HugGANModelHubMixin
but I get:
ModuleNotFoundError: No module named 'huggan'.
I cloned the model locally and try to run it from VSC.
As far I understand is the problem that HugGANModelHubMixin is not available on HuggingFace because search for models returns no results.
How can I find a work around for this issue?

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.

405 : Client Error: Not Allowed for huggingface url

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).

How to override any Model of vendor folder in laravel

I am using MongoDB as database so I need to change model of package tzsk\payu as using original is giving me following error
Call to a member function prepare() on null
I tried excluding original model and overriding using composer it doesn't work.
The only way would be if the package offered the option to use a custom model, like Passport is doing.
As far as I can see, there does not seem to be a way to do that. Thus you'd need to fork the package and edit the Model yourself.

Swift - Import my swift class

This question is asked several times, but I can't find the right solution for my problem. I'm trying to import my Player.swift class in my MainScene.swift (I've used Cocos2D - SpriteBuilder to setup the project; Now using Xcode).
This is my folder structure:
I've tried to use import Player; and import Player.swift;, but when I tried I got this error: No such module 'Player.swift'
How do I import it correctly?
Thanks!
By the way, I'm a beginner in Swift, so don't expect that I know all of the terms
You don't need to explicitly import files in Swift as they are globally available through the project. If you want to access the methods or properties of Player class, you can directly make object of Player class in MainScene.Swift file and can access to it.
e.g var objPlayer = Player()
There is no need to import swift classes to use in other swift classes.
They are available to use automatically.
In Swift you can only import module, e.g. any framework like UIKit, MapKit as below. You cannot import swift classes.
import UIKit
import MapKit
Just make sure its selected to use in target in which your are trying to use.
Check below images for more idea.
In this image my HomeViewController.swift is selected to use in AutolayoutDemo module.
In below image I have unchecked AutolayoutDemo module for the class DetailsViewController.swift.
So now onwards when I will try to use the DetailsViewController compiler will give me error as below image in HomeViewController.
When it comes to Swift imports, there are two cases:
1) The type to import is in the module
In this case, no import statement is needed. As long as the type is not private or fileprivate, you can directly access it.
2) The type to import is outside of the module
You can import an entire module using:
import ModuleName
If you only want to import a specific type or function from the module, you can do this using the following format:
import kindOfThing ModuleName.Type
where kindOfThing is class/struct/func/etc...
A much deeper exploration of this can be found on NSHipster here.
Check if the class is added to your iOS target in right Pane or not .

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.

Resources